diff --git a/.gitattributes b/.gitattributes index e3b1bd167ba59f6ae7b93d09ae6afbe0cb403a76..6b7781b917ed3a7c759030f775a489f81277a15f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1023,3 +1023,30 @@ western_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/images/sha western_ai/canada/cohere-toolkit/src/interfaces/assistants_web/public/videos/KYC_BG_5K.mp4 filter=lfs diff=lfs merge=lfs -text western_ai/canada/cohere-toolkit/src/interfaces/coral_web/public/images/kycCellBackground.png filter=lfs diff=lfs merge=lfs -text western_ai/canada/cohere-toolkit/src/interfaces/coral_web/public/images/share.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/images/citrinet_vertical.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/images/conf-ensembles-overview.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/images/conformer_ctc.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/images/hat.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/images/hybrid_asr_tts_model.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/images/jasper_vertical.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/images/quartz_vertical.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/images/squeezeformer.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/speaker_diarization/images/aosc_3spk_example.gif filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/speaker_diarization/images/asr_sd_diagram.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/speaker_diarization/images/ats.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/speaker_diarization/images/cache_fifo_chunk.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/speaker_diarization/images/data_flow.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/speaker_diarization/images/e2e_and_cascaded_diar_systems.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/speaker_diarization/images/intro_comparison.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/speaker_diarization/images/loss_types.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/speaker_diarization/images/main_dataflow.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/speaker_diarization/images/ms_trade_off.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/speaker_diarization/images/msdd_train_and_infer.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/speaker_diarization/images/scale_weight_cnn.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/speaker_diarization/images/sortformer.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/speaker_diarization/images/streaming_steps.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/speaker_diarization/images/weighted_sum.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/speaker_recognition/images/ICASPP_SpeakerNet.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/speaker_recognition/images/titanet_network.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/speech_classification/images/marblenet_vertical.png filter=lfs diff=lfs merge=lfs -text +western_ai/canada/nemo/docs/source/asr/speech_classification/images/matchboxnet_vertical.png filter=lfs diff=lfs merge=lfs -text diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/hooks/streamChat.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/hooks/streamChat.ts new file mode 100644 index 0000000000000000000000000000000000000000..de0d7f51261702fbc948fad9927edbaf5bcea63b --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/hooks/streamChat.ts @@ -0,0 +1,140 @@ +import { EventSourceMessage } from '@microsoft/fetch-event-source'; +import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { useEffect, useRef } from 'react'; + +import { + ChatResponseEvent as ChatResponse, + CohereChatRequest, + CohereNetworkError, + ConversationPublic, + FinishReason, + StreamEnd, + StreamEvent, + isUnauthorizedError, + useCohereClient, +} from '@/cohere-client'; +import { useExperimentalFeatures } from '@/hooks/experimentalFeatures'; + +interface StreamingParams { + onRead: (data: ChatResponse) => void; + onHeaders: (headers: Headers) => void; + onFinish: () => void; + onError: (error: unknown) => void; +} + +export interface StreamingChatParams extends StreamingParams { + request: CohereChatRequest; + headers: Record; +} + +const getUpdatedConversations = + (conversationId: string | undefined, description: string = '') => + (conversations: ConversationPublic[] | undefined) => { + return conversations?.map((c) => { + if (c.id !== conversationId) return c; + + return { + ...c, + description, + updatedAt: new Date().toISOString(), + }; + }); + }; + +export const useStreamChat = () => { + const abortControllerRef = useRef(null); + const cohereClient = useCohereClient(); + const queryClient = useQueryClient(); + const { data: experimentalFeatures } = useExperimentalFeatures(); + + useEffect(() => { + return () => { + abortControllerRef.current?.abort(); + }; + }, []); + + const retry = (failCount: number, error: CohereNetworkError) => { + // we allow 1 retry for 401 errors + if (isUnauthorizedError(error)) { + return failCount < 1; + } + return false; + }; + + const updateConversationHistory = (data?: StreamEnd) => { + if (!data) return; + + queryClient.setQueryData( + ['conversations'], + getUpdatedConversations(data?.conversation_id ?? '', data?.text) + ); + }; + + const chatMutation = useMutation({ + mutationFn: async (params: StreamingChatParams) => { + try { + queryClient.setQueryData( + ['conversations'], + getUpdatedConversations(params.request.conversation_id ?? '', params.request.message) + ); + + abortControllerRef.current = new AbortController(); + + const { request, headers, onRead, onError, onFinish } = params; + + const chatStreamParams = { + request, + headers, + signal: abortControllerRef.current.signal, + onMessage: (event: EventSourceMessage) => { + try { + if (!event.data) return; + const data = JSON.parse(event.data); + + if (data?.event === StreamEvent.STREAM_END) { + const streamEndData = data.data as StreamEnd; + + if (streamEndData.finish_reason !== FinishReason.COMPLETE) { + throw new Error(streamEndData.error || 'Stream ended unexpectedly'); + } + + if (params.request.conversation_id) { + queryClient.setQueryData( + ['conversations'], + getUpdatedConversations(params.request.conversation_id, streamEndData.text) + ); + } + } + onRead(data); + } catch (e) { + const errMsg = e instanceof Error ? e.message : 'unable to parse event data'; + throw new Error(errMsg); + } + }, + onError: (err: unknown) => { + onError(err); + // Rethrow to stop the operation + throw err; + }, + onClose: () => { + onFinish(); + }, + }; + + await cohereClient.chat({ ...chatStreamParams }); + } catch (e) { + if (isUnauthorizedError(e)) { + await queryClient.invalidateQueries({ queryKey: ['defaultAPIKey'] }); + } + return Promise.reject(e); + } + }, + retry, + onSuccess: updateConversationHistory, + }); + + return { + chatMutation, + abortController: abortControllerRef, + }; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/hooks/tags.tsx b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/hooks/tags.tsx new file mode 100644 index 0000000000000000000000000000000000000000..8e0ac26522b1c7e93b7204babddc0e134392abd3 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/hooks/tags.tsx @@ -0,0 +1,101 @@ +import { useMemo, useState } from 'react'; + +import { ToolDefinition } from '@/cohere-client'; +import { Tag } from '@/components/Conversation/Composer/DataSourceMenu'; +import { TOOL_FALLBACK_ICON, TOOL_ID_TO_DISPLAY_INFO } from '@/constants'; +import { useListFiles } from '@/hooks/files'; +import { useListTools } from '@/hooks/tools'; +import { useConversationStore } from '@/stores'; +import { formatFileSize } from '@/utils'; + +/** + * @description Hook that contains all the logic for filtering and displaying tags + * for data sources. + */ +export const useDataSourceTags = ({ requiredTools }: { requiredTools?: string[] }) => { + const [tagQuery, setTagQuery] = useState(''); + const { + conversation: { id }, + } = useConversationStore(); + const query = tagQuery.replace('@', ''); + const { data: tools = [] } = useListTools(); + const { data: files } = useListFiles(id); + const onlyRequiredTools = useMemo(() => { + const availableTools = tools.filter((t) => t.is_visible && t.is_available); + if (!requiredTools) { + return availableTools; + } + + return requiredTools + .map((rt) => availableTools.find((t) => t.name === rt)) + .filter((t) => !!t) as ToolDefinition[]; + }, [tools, requiredTools]); + + const filteredFileIdTags: Tag[] = useMemo( + () => + (files ?? []) + .filter((file) => { + return file.file_name.toLowerCase().includes(query.toLowerCase()); + }) + .map(({ id, file_name, file_size = 0 }) => ({ + id, + name: file_name, + metadata: formatFileSize(file_size), + getValue: () => id, + })), + [files, query] + ); + + const allToolTags: Tag[] = useMemo(() => { + const allTools = []; + for (const t of onlyRequiredTools) { + allTools.push({ + id: t.name ?? '', + name: t.display_name ?? t.name ?? '', + description: t.description ?? '', + icon: TOOL_ID_TO_DISPLAY_INFO[t.name ?? '']?.icon ?? TOOL_FALLBACK_ICON, + getValue: () => t, + }); + } + return allTools; + }, [onlyRequiredTools]); + const filteredToolTags: Tag[] = useMemo( + () => + allToolTags.filter( + (tag) => + tag.id.toLowerCase().includes(query.toLowerCase()) || + tag.name.toLowerCase().includes(query.toLowerCase()) + ), + [allToolTags, query] + ); + + // if user types @ at the current input cursor position, return the @ and the string that follows + const getTagQuery = (value: string, cursorPosition: number): string => { + // Find the nearest space to the left of the cursor position + const spaceIndex = value.lastIndexOf(' ', cursorPosition); + + // Determine the starting index based on the nearest space + const startIndex = spaceIndex !== -1 ? spaceIndex + 1 : 0; + + // Match the first word of the string if it starts with "@" + const regexPattern = /^@(\S*)/; + const match = value.substring(startIndex).match(regexPattern); + if (match) { + return match[0]; + } + return ''; + }; + + return { + suggestedTags: { + fileIds: filteredFileIdTags, + tools: filteredToolTags, + }, + totalTags: { + fileIds: files?.length ?? 0, + }, + tagQuery, + setTagQuery, + getTagQuery, + }; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/hooks/toast.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/hooks/toast.ts new file mode 100644 index 0000000000000000000000000000000000000000..f4f6b2b66dcbeabb7907c6006c79d800cadf2c17 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/hooks/toast.ts @@ -0,0 +1,16 @@ +import { toast } from 'sonner'; + +export const useNotify = () => { + const error = (message: string) => + toast.error(message, { + duration: Infinity, + cancel: { label: 'x', onClick: () => toast.dismiss() }, + }); + const info = (message: string) => toast.info(message, { duration: 5000 }); + const success = (message: string) => toast.success(message, { duration: 5000 }); + const loading = (message: string) => toast.loading(message); + + const dismiss = (id: string | number) => toast.dismiss(id); + + return { error, info, success, loading, dismiss }; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/hooks/tools.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/hooks/tools.ts new file mode 100644 index 0000000000000000000000000000000000000000..4b105334551732ac9958d5349e71b96af42ca062 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/hooks/tools.ts @@ -0,0 +1,93 @@ +import { useLocalStorageValue } from '@react-hookz/web'; +import { useQuery } from '@tanstack/react-query'; +import useDrivePicker from 'react-google-drive-picker'; +import type { PickerCallback } from 'react-google-drive-picker/dist/typeDefs'; + +import { ToolDefinition, useCohereClient } from '@/cohere-client'; +import { LOCAL_STORAGE_KEYS, TOOL_GOOGLE_DRIVE_ID } from '@/constants'; +import { STRINGS } from '@/constants/strings'; +import { env } from '@/env.mjs'; +import { useNotify } from '@/hooks/toast'; + +export const useListTools = (enabled: boolean = true) => { + const client = useCohereClient(); + return useQuery({ + queryKey: ['tools'], + queryFn: () => client.listTools({}), + refetchOnWindowFocus: false, + enabled, + }); +}; + +/** + * @description A hook that returns a list of tools that require authentication + */ +export const useUnauthedTools = (enabled: boolean = true) => { + const { data: tools } = useListTools(enabled); + const unauthedTools = tools?.filter((tool) => tool.is_auth_required) ?? []; + const isToolAuthRequired = unauthedTools.length > 0; + return { unauthedTools, isToolAuthRequired }; +}; + +export const useShowUnauthedToolsModal = () => { + const { isToolAuthRequired } = useUnauthedTools(); + const { value: hasDismissed, set } = useLocalStorageValue( + LOCAL_STORAGE_KEYS.unauthedToolsModalDismissed, + { + defaultValue: false, + initializeWithValue: true, + } + ); + return { + show: !hasDismissed && isToolAuthRequired, + onDismissed: () => set(true), + }; +}; + +export const useOpenGoogleDrivePicker = (callbackFunction: (data: PickerCallback) => void) => { + const [openPicker] = useDrivePicker(); + const { data: toolsData } = useListTools(); + const { info } = useNotify(); + + const googleDriveTool = toolsData?.find((tool) => tool.name === TOOL_GOOGLE_DRIVE_ID); + + const handleCallback = (data: PickerCallback) => { + if (!data.docs) return; + + const folders = data.docs.filter((doc) => doc.type === 'folder'); + const files = data.docs.filter((doc) => doc.type !== 'folder'); + + if (folders.length > 0 && files.length > 0) { + info(STRINGS.selectGoogleDriveFilesOrFolders); + return; + } + if (files.length > 5) { + info(STRINGS.selectMaxGoogleDriveFilesDescription); + return; + } + + callbackFunction(data); + }; + + const googleDriveClientId = env.NEXT_PUBLIC_GOOGLE_DRIVE_CLIENT_ID; + const googleDriveDeveloperKey = env.NEXT_PUBLIC_GOOGLE_DRIVE_DEVELOPER_KEY; + if (!googleDriveClientId || !googleDriveDeveloperKey) { + return () => { + info(STRINGS.googleDriveUnavailableError); + }; + } + + return () => + openPicker({ + clientId: googleDriveClientId, + developerKey: googleDriveDeveloperKey, + token: googleDriveTool?.token || '', + setIncludeFolders: true, + setSelectFolderEnabled: true, + showUploadView: false, + showUploadFolders: false, + supportDrives: true, + multiselect: true, + callbackFunction: handleCallback, + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/hooks/typed.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/hooks/typed.ts new file mode 100644 index 0000000000000000000000000000000000000000..3e96d97a110b36767decaa69180736434c481d35 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/hooks/typed.ts @@ -0,0 +1,95 @@ +import { useEffect, useState } from 'react'; + +type TypeOptions = { + typeSpeed?: number; + charactersPerInterval?: number; + paragraphDelay?: number; + enabled?: boolean; + onParagraphTyped?: (paragraphIndex: number) => void; +}; + +/** + * A hook to render text with a typing effect. + * Each character in a phrase is "typed" at the designated `typeSpeed` and each + * phrase begins "typing" after the designated `paragraphDelay`. + * @param texts - the phrases to be typed out + * @param options.typeSpeed - delay between characters typed in ms + * @param options.charactersPerInterval - number of chars to be typed at a time + * @param options.paragraphDelay - delay between paragraphs in ms + * @param options.enabled - whether or not to start typing + * @param options.onParagraphTyped - callback when a paragraph is fully typed + + */ +export const useTyped = ( + texts: string[], + { + typeSpeed = 5, + charactersPerInterval = 1, + paragraphDelay = 1000, + enabled = true, + onParagraphTyped, + }: TypeOptions +) => { + const [typed, setTyped] = useState(''); + const [isTyping, setIsTyping] = useState(); + const [isFinished, setIsFinished] = useState(false); + const [timer, setTimer] = useState(); + + // reset state when texts change + useEffect(() => { + setTyped(''); + setIsTyping(false); + setIsFinished(false); + clearTimeout(timer); + setTimer(undefined); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [texts]); + + useEffect(() => { + if (!enabled) return; + if (isFinished) return; + + setIsTyping(true); + + let fullyTyped = ''; + let phraseIndex = 0; + let charIndex = 0; + setTimer( + setTimeout(function type() { + fullyTyped += texts[phraseIndex].slice(charIndex, charIndex + charactersPerInterval); + setTyped(fullyTyped); + charIndex += charactersPerInterval; + + if (charIndex >= texts[phraseIndex].length) { + charIndex = 0; + phraseIndex += 1; + onParagraphTyped?.(phraseIndex); + + if (phraseIndex === texts.length) { + setIsTyping(false); + setIsFinished(true); + clearTimeout(timer); + } else { + setTimer(setTimeout(type, paragraphDelay)); + } + } else { + setTimer(setTimeout(type, typeSpeed)); + } + }, 0) + ); + + return () => clearTimeout(timer); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [ + texts, + typeSpeed, + isTyping, + paragraphDelay, + charactersPerInterval, + enabled, + isFinished, + onParagraphTyped, + ]); + + return { typed, isTyping }; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/hooks/utils.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/hooks/utils.ts new file mode 100644 index 0000000000000000000000000000000000000000..d56b00f5856a7d10f0ad3cc2db9c7804bb2bcc63 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/hooks/utils.ts @@ -0,0 +1,42 @@ +import { useState } from 'react'; + +/** + * + * A hook used to track steps in a type-safe way. + * + * @param numberOfSteps The number of steps to track + * @param onComplete A callback to be called when the last step is reached + * @returns An object containing the current step and a function to set the current step + * + * @example + * const { step, setStep } = useSteps(3, () => console.info('done')); + * setStep(1); // step is now 1 + * setStep(2); // step is now 2 + * setStep(3); // step is now 3 and 'done' is logged to the console + * + * Note: It's best used with numeric enums + * + * @example + * enum Steps { + * Step1, + * Step2, + * Step3, + * } + * const { step, setStep } = useSteps(Steps.Step3, () => console.info('done')); + */ +export const useSteps = (numberOfSteps: number, onComplete: VoidFunction) => { + const [step, _setStep] = useState(0); + + const setStep = (step: T) => { + if (step > numberOfSteps) return; + _setStep(step); + if (step === numberOfSteps) { + onComplete(); + } + }; + + return { + step: step as T, + setStep, + }; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/index.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..876901eca64730088a63d2161bedcf14501f86fa --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/index.ts @@ -0,0 +1,97 @@ +import { create } from 'zustand'; +import { shallow } from 'zustand/shallow'; + +import { ToolDefinition } from '@/cohere-client'; +import { AgentsStore, createAgentsSlice } from '@/stores/slices/agentsSlice'; +import { CitationsStore, createCitationsSlice } from '@/stores/slices/citationsSlice'; +import { ConversationStore, createConversationSlice } from '@/stores/slices/conversationSlice'; +import { FilesStore, createFilesSlice } from '@/stores/slices/filesSlice'; +import { ParamStore, createParamsSlice } from '@/stores/slices/paramsSlice'; + +export type ChatSettingsDefaultsValue = { + preamble?: string; + model?: string; + temperature?: number; + tools?: ToolDefinition[]; +}; + +export type StoreState = CitationsStore & ConversationStore & FilesStore & ParamStore & AgentsStore; + +const useStore = create((...a) => ({ + ...createCitationsSlice(...a), + ...createConversationSlice(...a), + ...createFilesSlice(...a), + ...createParamsSlice(...a), + ...createAgentsSlice(...a), +})); + +export const useCitationsStore = () => { + return useStore( + (state) => ({ + citations: state.citations, + addSearchResults: state.addSearchResults, + addCitation: state.addCitation, + selectCitation: state.selectCitation, + hoverCitation: state.hoverCitation, + resetCitations: state.resetCitations, + saveOutputFiles: state.saveOutputFiles, + agents: state.agents, + }), + shallow + ); +}; + +export const useConversationStore = () => { + return useStore( + (state) => ({ + conversation: state.conversation, + setConversation: state.setConversation, + setPendingMessage: state.setPendingMessage, + resetConversation: state.resetConversation, + }), + shallow + ); +}; + +export const useFilesStore = () => { + return useStore( + (state) => ({ + files: state.files, + queueFocusFileInput: state.queueFocusFileInput, + clearFocusFileInput: state.clearFocusFileInput, + addUploadingFile: state.addUploadingFile, + addUploadingFiles: state.addUploadingFiles, + deleteUploadingFile: state.deleteUploadingFile, + addComposerFile: state.addComposerFile, + deleteComposerFile: state.deleteComposerFile, + clearComposerFiles: state.clearComposerFiles, + clearUploadingErrors: state.clearUploadingErrors, + updateUploadingFileError: state.updateUploadingFileError, + }), + shallow + ); +}; + +export const useParamsStore = () => { + return useStore( + (state) => ({ + params: state.params, + setParams: state.setParams, + resetFileParams: state.resetFileParams, + }), + shallow + ); +}; + +export const useAgentsStore = () => { + return useStore( + (state) => ({ + agents: state.agents, + setAgentsSidePanelOpen: state.setAgentsSidePanelOpen, + setEditAgentPanelOpen: state.setEditAgentPanelOpen, + }), + shallow + ); +}; + +export { useSettingsStore } from '@/stores/persistedStore'; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/persistedStore.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/persistedStore.ts new file mode 100644 index 0000000000000000000000000000000000000000..731d518946e6f4ff4da3cfa681efdb7817190a24 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/persistedStore.ts @@ -0,0 +1,54 @@ +import { useEffect, useState } from 'react'; +import { create } from 'zustand'; +import { persist } from 'zustand/middleware'; +import { shallow } from 'zustand/shallow'; + +import { SettingsStore, createSettingsSlice } from '@/stores/slices/settingsSlice'; + +type PersistedStore = SettingsStore; + +const useEmptyPersistedStore = create((...a) => ({ + ...createSettingsSlice(...a), +})); + +const usePersistedStore = create()( + persist( + (...a) => ({ + ...createSettingsSlice(...a), + }), + { + name: 'persisted-store', + version: 2, + } + ) +); +/** + * Wrap usePersistedStore with a hook that returns an empty store until the persisted store is hydrated. + * This avoids an issue where the server-rendered HTML does not match with the first client render, + * since the server cannot load from localStorage and renders with an empty store, while the client + * would load from localStorage and render with a hydrated store. + * + * By waiting until after a useEffect completes for the client render, the first render will use + * an empty store and match the server. + * + * @see https://github.com/pmndrs/zustand/issues/1145#issuecomment-1207233036 + */ +const usePersistedStoresWithHydration = ((selector, compare) => { + const emptyStore = useEmptyPersistedStore(selector, compare); + const store = usePersistedStore(selector, compare); + const [hydrated, setHydrated] = useState(false); + useEffect(() => setHydrated(true), []); + + return hydrated ? store : emptyStore; +}) as typeof usePersistedStore; + +export const useSettingsStore = () => { + return usePersistedStoresWithHydration( + (state) => ({ + settings: state.settings, + setSettings: state.setSettings, + setIsConvListPanelOpen: state.setIsConvListPanelOpen, + }), + shallow + ); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/slices/agentsSlice.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/slices/agentsSlice.ts new file mode 100644 index 0000000000000000000000000000000000000000..3ac2dabdfb46f937e305cf6dff514472c0fa3006 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/slices/agentsSlice.ts @@ -0,0 +1,41 @@ +import { StateCreator } from 'zustand'; + +import { StoreState } from '@/stores'; + +const INITIAL_STATE = { + isEditAgentPanelOpen: false, + isAgentsSidePanelOpen: true, +}; + +type State = { + isAgentsSidePanelOpen: boolean; + isEditAgentPanelOpen: boolean; +}; +type Actions = { + setAgentsSidePanelOpen: (isOpen: boolean) => void; + setEditAgentPanelOpen: (isOpen: boolean) => void; +}; + +export type AgentsStore = { + agents: State; +} & Actions; + +export const createAgentsSlice: StateCreator = (set) => ({ + setAgentsSidePanelOpen(isOpen) { + set((state) => ({ + agents: { + ...state.agents, + isAgentsSidePanelOpen: isOpen, + }, + })); + }, + setEditAgentPanelOpen(isOpen) { + set((state) => ({ + agents: { + ...state.agents, + isEditAgentPanelOpen: isOpen, + }, + })); + }, + agents: INITIAL_STATE, +}); diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/slices/citationsSlice.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/slices/citationsSlice.ts new file mode 100644 index 0000000000000000000000000000000000000000..8eb1c35b0c8659324a9720d42f42dbf28874f05c --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/slices/citationsSlice.ts @@ -0,0 +1,121 @@ +import { StateCreator } from 'zustand'; + +import { Document } from '@/cohere-client'; + +import { StoreState } from '..'; + +const INITIAL_STATE: State = { + citationReferences: {}, + hasCitations: false, + selectedCitation: null, + hoveredGenerationId: null, + searchResults: {}, + outputFiles: {}, +}; + +type Citation = { + generationId: string; + start: string; + end: string; + /** Used to scroll to highlight position */ + yPosition: number | null; +}; + +type CitationReferences = { + [generationId: string]: { + /** In the format: {startIndex}-{endIndex} */ + [startEndKey: string]: Document[]; + }; +}; + +interface SearchResults { + [documentId: string]: Record; +} + +export type OutputFiles = { [name: string]: { name: string; data: string; documentId?: string } }; + +type State = { + citationReferences: CitationReferences; + hasCitations: boolean; + selectedCitation: Citation | null; + hoveredGenerationId: string | null; + searchResults: SearchResults; + outputFiles: OutputFiles; +}; + +type Actions = { + addSearchResults: (results: Record) => void; + addCitation: (generationId: string, startEndKey: string, documents: Document[]) => void; + selectCitation: (citation: Citation | null) => void; + hoverCitation: (generationId: string | null) => void; + resetCitations: VoidFunction; + saveOutputFiles: (outputFiles: OutputFiles) => void; +}; + +export type CitationsStore = { + citations: State; +} & Actions; + +export const createCitationsSlice: StateCreator = (set) => ({ + addSearchResults(results) { + set((state) => { + const newResults = { ...state.citations.searchResults }; + (results || []).forEach((result: any) => { + (result?.documentIds ?? []).forEach((docId: string) => { + newResults[docId] = result; + }); + }); + return { + citations: { + ...state.citations, + ...(results ? { searchResults: newResults } : {}), + }, + }; + }); + }, + addCitation(generationId, startEndKey, documents) { + set((state) => ({ + citations: { + ...state.citations, + citationReferences: { + ...state.citations.citationReferences, + [generationId]: { + ...state.citations.citationReferences[generationId], + [startEndKey]: documents, + }, + }, + hasCitations: true, + }, + })); + }, + selectCitation(citation) { + set((state) => ({ + citations: { + ...state.citations, + selectedCitation: citation, + }, + })); + }, + hoverCitation(generationId) { + set((state) => ({ + citations: { + ...state.citations, + hoveredGenerationId: generationId, + }, + })); + }, + resetCitations() { + set(() => ({ + citations: INITIAL_STATE, + })); + }, + saveOutputFiles(outputFiles) { + set((state) => ({ + citations: { + ...state.citations, + outputFiles, + }, + })); + }, + citations: INITIAL_STATE, +}); diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/slices/conversationSlice.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/slices/conversationSlice.ts new file mode 100644 index 0000000000000000000000000000000000000000..2d791b1c58718b14ccb60000d07559a7c1617fbb --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/slices/conversationSlice.ts @@ -0,0 +1,90 @@ +import { StateCreator } from 'zustand'; + +import { DEFAULT_CONVERSATION_NAME } from '@/constants'; +import { + ChatMessage, + FulfilledMessage, + LoadingMessage, + TypingMessage, + isLoadingMessage, + isTypingMessage, +} from '@/types/message'; + +import { StoreState } from '..'; + +const INITIAL_STATE: State = { + id: undefined, + name: DEFAULT_CONVERSATION_NAME, + messages: [], +}; + +type State = { + id?: string; + name?: string; + messages: ChatMessage[]; +}; + +type Actions = { + setConversation: (conversation: Partial) => void; + setPendingMessage: (message: FulfilledMessage | LoadingMessage | TypingMessage | null) => void; + resetConversation: VoidFunction; +}; + +export type ConversationStore = { + conversation: State; +} & Actions; + +export const createConversationSlice: StateCreator = ( + set +) => ({ + setConversation(conversation) { + set((state) => ({ + conversation: { + ...state.conversation, + ...conversation, + }, + })); + }, + resetConversation() { + set(() => ({ + conversation: INITIAL_STATE, + })); + }, + setPendingMessage(message) { + if (!message) { + set((state) => ({ + conversation: { + ...state.conversation, + messages: state.conversation.messages.filter((m) => !isLoadingMessage(m)), + }, + })); + return; + } + + set((state) => { + const messages = state.conversation.messages; + const newMessages: ChatMessage[] = []; + let found = false; + + messages.forEach((m) => { + if (isTypingMessage(m) || isLoadingMessage(m)) { + newMessages.push({ + ...m, + ...message, + }); + found = true; + } else { + newMessages.push(m); + } + }); + + return { + conversation: { + ...state.conversation, + messages: found ? newMessages : messages.concat(message), + }, + }; + }); + }, + conversation: INITIAL_STATE, +}); diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/slices/filesSlice.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/slices/filesSlice.ts new file mode 100644 index 0000000000000000000000000000000000000000..210efad51230fa9570e84f6a39b738626e5c8ddd --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/slices/filesSlice.ts @@ -0,0 +1,139 @@ +import { StateCreator } from 'zustand'; + +import { ListConversationFile as CohereFile } from '@/cohere-client'; + +import { StoreState } from '..'; + +const INITIAL_STATE: State = { + isFileInputQueuedToFocus: false, + uploadingFiles: [], + composerFiles: [], +}; + +export interface UploadingFile { + id: string; + file: File; + error?: string; + progress: number; +} + +type State = { + isFileInputQueuedToFocus: boolean; + uploadingFiles: UploadingFile[]; + composerFiles: CohereFile[]; +}; + +type Actions = { + queueFocusFileInput: () => void; + clearFocusFileInput: () => void; + addUploadingFile: (file: UploadingFile) => void; + addUploadingFiles: (files: UploadingFile[]) => void; + addComposerFile: (file: CohereFile) => void; + updateUploadingFileError: (file: UploadingFile, error: string) => void; + deleteUploadingFile: (id: string) => void; + deleteComposerFile: (id: string) => void; + clearUploadingErrors: () => void; + clearComposerFiles: () => void; +}; + +export type FilesStore = { + files: State; +} & Actions; + +export const createFilesSlice: StateCreator = (set) => ({ + queueFocusFileInput() { + set((state) => ({ + files: { + ...state.files, + isFileInputQueuedToFocus: true, + }, + })); + }, + clearFocusFileInput() { + set((state) => ({ + files: { + ...state.files, + isFileInputQueuedToFocus: false, + }, + })); + }, + addUploadingFile(file) { + set((state) => ({ + files: { + ...state.files, + uploadingFiles: [...state.files.uploadingFiles, file], + }, + })); + }, + addUploadingFiles(files) { + set((state) => ({ + files: { + ...state.files, + uploadingFiles: [...state.files.uploadingFiles, ...files], + }, + })); + }, + addComposerFile(file) { + set((state) => ({ + files: { + ...state.files, + composerFiles: [...state.files.composerFiles, file], + }, + })); + }, + updateUploadingFileError(file, error) { + set((state) => { + const newUploadingFiles = [...state.files.uploadingFiles]; + const uploadingFile = newUploadingFiles.find((f) => f.id === file.id); + if (uploadingFile) { + uploadingFile.error = error; + return { + files: { + ...state.files, + uploadingFiles: newUploadingFiles, + }, + }; + } + + return {}; + }); + }, + deleteUploadingFile(id) { + set((state) => ({ + files: { + ...state.files, + uploadingFiles: state.files.uploadingFiles.filter((f) => f.id !== id), + }, + })); + }, + deleteComposerFile(id) { + set((state) => ({ + files: { + ...state.files, + composerFiles: state.files.composerFiles.filter((f) => f.id !== id), + }, + })); + }, + clearUploadingErrors() { + set((state) => { + const newUploadingFiles = state.files.uploadingFiles.filter( + (f) => typeof f.error === 'undefined' + ); + return { + files: { + ...state.files, + uploadingFiles: newUploadingFiles, + }, + }; + }); + }, + clearComposerFiles() { + set((state) => ({ + files: { + ...state.files, + composerFiles: [], + }, + })); + }, + files: INITIAL_STATE, +}); diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/slices/paramsSlice.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/slices/paramsSlice.ts new file mode 100644 index 0000000000000000000000000000000000000000..d6c3bcf4d7fd9f653097b1a51d398d67c3c5e9f6 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/slices/paramsSlice.ts @@ -0,0 +1,64 @@ +import { StateCreator } from 'zustand'; + +import { CohereChatRequest, DEFAULT_CHAT_TEMPERATURE } from '@/cohere-client'; +import { isDefaultFileLoaderTool } from '@/utils'; + +import { StoreState } from '..'; + +const INITIAL_STATE: ConfigurableParams = { + model: undefined, + temperature: DEFAULT_CHAT_TEMPERATURE, + preamble: '', + tools: [], + fileIds: [], + deployment: undefined, + deploymentConfig: undefined, +}; + +export type ConfigurableParams = Pick & { + preamble: string; + fileIds: CohereChatRequest['file_ids']; + model?: string; + deployment?: string; + deploymentConfig?: string; +}; + +type State = ConfigurableParams; +type Actions = { + setParams: (params?: Partial | null) => void; + resetFileParams: VoidFunction; +}; + +export type ParamStore = { + params: State; +} & Actions; + +export const createParamsSlice: StateCreator = (set) => ({ + setParams(params?) { + let tools = params?.tools; + let fileIds = params?.fileIds; + + set((state) => { + return { + params: { + ...state.params, + ...params, + ...(tools ? { tools } : []), + ...(fileIds ? { fileIds } : {}), + }, + }; + }); + }, + resetFileParams() { + set((state) => { + return { + params: { + ...state.params, + fileIds: [], + tools: state.params?.tools?.filter((t) => !isDefaultFileLoaderTool(t)), + }, + }; + }); + }, + params: INITIAL_STATE, +}); diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/slices/settingsSlice.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/slices/settingsSlice.ts new file mode 100644 index 0000000000000000000000000000000000000000..53591b0ed57c2d7da5a232c97cbe168fcb5f4e24 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/stores/slices/settingsSlice.ts @@ -0,0 +1,45 @@ +import { StateCreator } from 'zustand'; + +const INITIAL_STATE: Required = { + isConfigDrawerOpen: false, + activeConfigDrawerTab: '', + isConvListPanelOpen: true, + isMobileConvListPanelOpen: false, +}; + +type State = { + isConfigDrawerOpen: boolean; + activeConfigDrawerTab: string; + isConvListPanelOpen: boolean; + isMobileConvListPanelOpen: boolean; +}; + +type Actions = { + setSettings: (settings: Partial) => void; + setIsConvListPanelOpen: (isOpen: boolean) => void; +}; + +export type SettingsStore = { + settings: State; +} & Actions; + +export const createSettingsSlice: StateCreator = (set) => ({ + setSettings(settings) { + set((state) => ({ + settings: { + ...state.settings, + ...settings, + }, + })); + }, + setIsConvListPanelOpen(isOpen) { + set((state) => ({ + settings: { + ...state.settings, + isConvListPanelOpen: isOpen, + isMobileConvListPanelOpen: isOpen, + }, + })); + }, + settings: INITIAL_STATE, +}); diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/styles/code-style.css b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/styles/code-style.css new file mode 100644 index 0000000000000000000000000000000000000000..fb9036536473858f57e006ae0923097ea2e41ebf --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/styles/code-style.css @@ -0,0 +1,265 @@ +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #212121; + background: transparent; +} + +.linenumber { + color: #556f65; +} + +.hljs-comment { + color: #212121; + font-style: italic; +} + +.hljs-quote { + color: #ca492d; + font-style: italic; +} + +.hljs-keyword { + color: #2d4cb9; +} + +.hljs-selector-tag { + color: #afa694; +} + +.hljs-literal { + color: #9b60aa; +} + +.hljs-subst { + color: #9b60aa; +} + +.hljs-number { + color: #39594d; +} + +.hljs-string { + color: #ca492d; +} + +.hljs-doctag { + color: #ca492d; +} + +.hljs-selector-id { + color: #39594d; +} + +.hljs-selector-class { + color: #39594d; +} + +.hljs-section { + color: #39594d; +} + +.hljs-type { + color: #39594d; +} + +.hljs-params { + color: #9b60aa; +} + +.hljs-title { + color: #9b60aa; + font-weight: bold; +} + +.hljs-tag { + color: #9b60aa; + font-weight: normal; +} + +.hljs-name { + color: #9b60aa; + font-weight: normal; +} + +.hljs-attribute { + color: #ca492d; + font-weight: normal; +} + +.hljs-attr { + color: #9b60aa; +} + +.hljs-variable { + color: #ca492d; +} + +.hljs-template-variable { + color: #ca492d; +} + +.hljs-regexp { + color: #9b60aa; +} + +.hljs-link { + color: #9b60aa; +} + +.hljs-function { + color: #9b60aa; +} + +.hljs-symbol { + color: #990073; +} + +.hljs-bullet { + color: #990073; +} + +.hljs-built_in { + color: #39594d; +} + +.hljs-builtin-name { + color: #2d4cb9; +} + +.hljs-meta { + color: #39594d; + font-weight: bold; +} + +.hljs-deletion { + background: #b20000; +} + +.hljs-addition { + background: #39594d; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +.dark { + .hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #eeeeee; + background: transparent; + } + + .linenumber { + color: #556f65; + } + + .hljs-comment { + color: #616161; + font-style: italic; + } + + .hljs-quote { + color: #ff7759; + font-style: italic; + } + + .hljs-keyword { + color: #77ecc5; + } + + .hljs-selector-tag { + color: #afa694; + } + + .hljs-literal, + .hljs-subst { + color: #e074fb; + } + + .hljs-number { + color: #77ecc5; + } + + .hljs-string, + .hljs-doctag, + .hljs-variable, + .hljs-template-variable { + color: #ff7759; + } + + .hljs-selector-id, + .hljs-selector-class, + .hljs-section, + .hljs-type, + .hljs-symbol, + .hljs-builtin-name { + color: #77ecc5; + } + + .hljs-params, + .hljs-title, + .hljs-tag, + .hljs-name, + .hljs-attribute, + .hljs-attr, + .hljs-regexp, + .hljs-link, + .hljs-function, + .hljs-meta { + color: #e074fb; + } + + .hljs-title, + .hljs-strong { + font-weight: bold; + } + + .hljs-tag, + .hljs-name, + .hljs-attribute, + .hljs-emphasis { + font-weight: normal; + } + + .hljs-regexp, + .hljs-link, + .hljs-function, + .hljs-symbol, + .hljs-bullet { + color: #990073; + } + + .hljs-built_in { + color: #77ecc5; + } + + .hljs-meta { + color: #eeeeee; + font-weight: bold; + } + + .hljs-deletion { + background: #b20000; + } + + .hljs-addition { + background: #77ecc5; + } + + .hljs-emphasis { + font-style: italic; + } + + .hljs-strong { + font-weight: bold; + } +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/styles/fonts.css b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/styles/fonts.css new file mode 100644 index 0000000000000000000000000000000000000000..4ce75444fd89f3a460b5d3cba3e2dc4c9edf7cff --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/styles/fonts.css @@ -0,0 +1,62 @@ +@font-face { + font-family: 'CohereText'; + src: url('https://fonts.cohere.com/CohereText-Regular.woff2') format('woff2'), + url('https://fonts.cohere.com/CohereText-Regular.woff') format('woff'); + font-weight: 400; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: 'CohereText'; + /* In the nature design system, bolded fonts always use Cohere Variable. */ + src: url('https://fonts.cohere.com/CohereVariable.woff2') format('woff2'), + url('https://fonts.cohere.com/CohereVariable.woff') format('woff'); + font-weight: 500 525; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: 'CohereMono'; + src: url('https://fonts.cohere.com/CohereMono-Regular.woff2') format('woff2'), + url('https://fonts.cohere.com/CohereMono-Regular.woff') format('woff'); + font-weight: 400; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: 'CohereMono'; + /* In the nature design system, bolded fonts always use Cohere Variable. */ + src: url('https://fonts.cohere.com/CohereVariable.woff2') format('woff2'), + url('https://fonts.cohere.com/CohereVariable.woff') format('woff'); + font-weight: 500 525; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: 'CohereVariable'; + src: url('https://fonts.cohere.com/CohereVariable.woff2') format('woff2'), + url('https://fonts.cohere.com/CohereVariable.woff') format('woff'); + font-weight: 400 420 450; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: 'CohereIconDefault'; + src: url('../../public/fonts/CohereIcon-Default.woff') format('woff'); + font-weight: normal; + font-style: normal; + font-display: block; +} + +@font-face { + font-family: 'CohereIconOutline'; + src: url('../../public/fonts/CohereIcon-Outline.woff') format('woff'); + font-weight: normal; + font-style: normal; + font-display: block; +} \ No newline at end of file diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/styles/globals.css b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/styles/globals.css new file mode 100644 index 0000000000000000000000000000000000000000..4bd1cb66a63e7baca0ada1b9d5b57956ffe893fe --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/styles/globals.css @@ -0,0 +1,38 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +body { + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + background-color: theme('colors.marble.1000'); + font-family: theme('fontFamily.body'); + font-size: 16px; + font-weight: 400; +} + +/* Google File Picker styles */ +.picker-dialog { + @apply rounded-lg border !border-marble-800 drop-shadow-2xl; +} + +@layer utilities { + .font-cuts-0 { + font-variation-settings: 'cuts' 0, 'move' 0; + } + + .font-cuts-1 { + font-variation-settings: 'cuts' 100, 'move' 100; + font-variant-ligatures: 'common-ligatures'; + } + + .font-cuts-2 { + font-variation-settings: 'cuts' 200, 'move' 200; + font-variant-ligatures: 'common-ligatures'; + } + + .font-cuts-3 { + font-variation-settings: 'cuts' 300, 'move' 300; + font-variant-ligatures: 'common-ligatures'; + } +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/styles/icons.css b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/styles/icons.css new file mode 100644 index 0000000000000000000000000000000000000000..f8db1cc16c4bde10c0af6d3561e1ab74e9898d72 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/styles/icons.css @@ -0,0 +1,345 @@ +.icon-default { + /* use !important to prevent issues with browser extensions that change fonts */ + font-family: 'CohereIconDefault' !important; + speak: never; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + + /* Better Font Rendering =========== */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-outline { + /* use !important to prevent issues with browser extensions that change fonts */ + font-family: 'CohereIconOutline' !important; + speak: never; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + + /* Better Font Rendering =========== */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-add-in-frame:before { + content: '\e900'; +} + +.icon-add:before { + content: '\e901'; +} + +.icon-arrow-down:before { + content: '\e902'; +} + +.icon-arrow-left:before { + content: '\e903'; +} + +.icon-arrow-right:before { + content: '\e904'; +} + +.icon-arrow-up:before { + content: '\e905'; +} + +.icon-arrow-up-right:before { + content: '\e906'; +} + +.icon-chat:before { + content: '\e907'; +} + +.icon-check-mark:before { + content: '\e908'; +} + +.icon-chevron-down:before { + content: '\e909'; +} + +.icon-chevron-left:before { + content: '\e90a'; +} + +.icon-chevron-right:before { + content: '\e90b'; +} + +.icon-chevron-up:before { + content: '\e90c'; +} + +.icon-close:before { + content: '\e90d'; +} + +.icon-close-drawer:before { + content: '\e90e'; +} + +.icon-copy:before { + content: '\e90f'; +} + +.icon-dashboard:before { + content: '\e910'; +} + +.icon-edit:before { + content: '\e911'; +} + +.icon-error:before { + content: '\e912'; +} + +.icon-file:before { + content: '\e913'; +} + +.icon-folder:before { + content: '\e914'; +} + +.icon-fullscreen:before { + content: '\e915'; +} + +.icon-grid:before { + content: '\e916'; +} + +.icon-help:before { + content: '\e917'; +} + +.icon-hide:before { + content: '\e918'; +} + +.icon-hourglass:before { + content: '\e919'; +} + +.icon-information:before { + content: '\e91a'; +} + +.icon-kebab:before { + content: '\e91b'; +} + +.icon-key:before { + content: '\e91c'; +} + +.icon-link:before { + content: '\e91d'; +} + +.icon-list:before { + content: '\e91e'; +} + +.icon-menu:before { + content: '\e91f'; +} + +.icon-notification:before { + content: '\e920'; +} + +.icon-payment:before { + content: '\e921'; +} + +.icon-profile:before { + content: '\e922'; +} + +.icon-range:before { + content: '\e923'; +} + +.icon-reorder:before { + content: '\e924'; +} + +.icon-search:before { + content: '\e925'; +} + +.icon-show:before { + content: '\e926'; +} + +.icon-start-now:before { + content: '\e927'; +} + +.icon-subtract:before { + content: '\e928'; +} + +.icon-success:before { + content: '\e929'; +} + +.icon-template:before { + content: '\e92a'; +} + +.icon-trash:before { + content: '\e92b'; +} + +.icon-upload:before { + content: '\e92c'; +} + +.icon-warning:before { + content: '\e92d'; +} + +.icon-thumbs-down:before { + content: '\e92e'; +} + +.icon-thumbs-up:before { + content: '\e92f'; +} + +.icon-enter:before { + content: '\e930'; +} + +.icon-redo:before { + content: '\e931'; +} + +.icon-new-message:before { + content: '\e932'; +} + +.icon-sources:before { + content: '\e933'; +} + +.icon-side-panel:before { + content: '\e934'; +} + +.icon-citations:before { + content: '\e935'; +} + +.icon-sparkle:before { + content: '\e936'; +} + +.icon-web:before { + content: '\e937'; +} + +.icon-clip:before { + content: '\e938'; +} + +.icon-download:before { + content: '\e939'; +} + +.icon-pin:before { + content: '\e93a'; +} + +.icon-calendar:before { + content: '\e93b'; +} + +.icon-code:before { + content: '\e93c'; +} + +.icon-globe-stand:before { + content: '\e93d'; +} + +.icon-book:before { + content: '\e93e'; +} + +.icon-book-open-text:before { + content: '\e93f'; +} + +.icon-flask:before { + content: '\e940'; +} + +.icon-list-magnifying-glass:before { + content: '\e941'; +} + +.icon-newspaper:before { + content: '\e942'; +} + +.icon-circles-four:before { + content: '\e943'; +} + +.icon-calculator:before { + content: '\e944'; +} + +.icon-github:before { + content: '\e945'; +} + +.icon-at:before { + content: '\e946'; +} + +.icon-plugs-connected:before { + content: '\e947'; +} + +.icon-settings:before { + content: '\e948'; +} + +.icon-magnifying-glass:before { + content: '\e949'; +} + +.icon-code-block:before { + content: '\e94a'; +} + +.icon-compass:before { + content: '\e94b'; +} + +.icon-wrench:before { + content: '\e94c'; +} + +.icon-share:before { + content: '\e94d'; +} + +.icon-selection-slash:before { + content: '\e94e'; +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/styles/main.css b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/styles/main.css new file mode 100644 index 0000000000000000000000000000000000000000..af9c9af7d76af9051639bf566b18b908414b8e39 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/styles/main.css @@ -0,0 +1,55 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +@import url('./fonts.css'); +@import url('./icons.css'); +@import url('./globals.css'); +@import url('./code-style.css'); + +@layer base { + html { + height: 100%; + width: 100%; + @apply selection:bg-marble-950 dark:selection:bg-marble-950; + + /* Firefox */ + scrollbar-color: theme('colors.marble.800') transparent; + } + + ::-webkit-scrollbar { + @apply h-2.5 w-2.5; + } + + ::-webkit-scrollbar-track { + @apply bg-transparent; + } + + ::-webkit-scrollbar-thumb { + box-shadow: inset 0 0 5px 5px rgb(189 189 189 / 0.5); /* marble-500/50 */ + @apply rounded-b-full rounded-t-full border-2 border-solid border-transparent; + } +} + +@layer utilities { + /* @see: https://css-tricks.com/scrollbars-on-hover/ */ + .hide-scrollbar { + overflow-y: scroll !important; + mask-position: left bottom; + mask-size: 100% 20000px; + mask-image: linear-gradient(to top, transparent, black), + linear-gradient(to left, transparent 12px, black 12px); + transition: mask-position 300ms ease; + transition-duration: 300ms; + } + + .hide-scrollbar:hover, + .hide-scrollbar:focus { + mask-position: left top; + } +} + +/* hide recaptcha badge */ +.grecaptcha-badge { + visibility: hidden; +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/themes/cohereTheme.js b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/themes/cohereTheme.js new file mode 100644 index 0000000000000000000000000000000000000000..6ce17d6cd02bbaa831e690dc771db75df162ec33 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/themes/cohereTheme.js @@ -0,0 +1,177 @@ +const defaultTheme = require('tailwindcss/defaultTheme'); + +// Any changes to the theme should be reflected into our `customTwMerge` in `utils/cn.ts` +module.exports = { + theme: { + extend: { + colors: { + black: '#212121', + white: '#FAFAFA', + // Simulated Coral + coral: { + 950: '#FFEAE5', + 900: '#FFD5CC', + 800: '#FFAC99', + 700: '#FF8266', + 600: '#FF5833', + 500: '#FF2F00', + 400: '#CC2500', + 300: '#991C00', + 200: '#661300', + 150: '#330900', + }, + // Mushroom Grey + mushroom: { + 950: '#F4F3F0', + 900: '#E9E7E2', + 800: '#D2CDC4', + 700: '#BDB6A8', + 600: '#A79E8B', + 500: '#91856E', + 400: '#70695C', + 300: '#575042', + 200: '#3A352C', + 150: '#2C2821', + }, + // Evolved Mushroom Grey + 'evolved-mushroom': { + 500: '#FFAA00', + 600: '#FFBB33', + 800: '#FFDC97', + }, + // Marble White + marble: { + 1000: '#FFFFFF', + 980: '#F9F9FB', + 950: '#EFEFF5', + 900: '#DFDFEC', + 850: '#D0D0E2', + 800: '#C4C4C4', + }, + // Volcanic Black + volcanic: { + 950: '#F2F2F2', + 900: '#E6E6E6', + 800: '#CBCBCB', + 700: '#B3B3B3', + 600: '#999999', + 500: '#808080', + 400: '#666666', + 300: '#4D4D4D', + 200: '#333333', + 150: '#262626', + 100: '#292929', + 60: '#0F0F0F', + }, + // Coniferous Green + green: { + 950: '#F0F5F3', + 900: '#E0EBE7', + 800: '#C0D6CD', + 700: '#A2C3B6', + 600: '#84AE9D', + 500: '#659A84', + 400: '#517B6A', + 250: '#324D42', + 200: '#283E35', + 150: '#141F1B', + }, + // Evolved Coniferous Green + 'evolved-green': { + 500: '#0DF293', + 700: '#6EF7BE', + 900: '#CFFCE9', + }, + // Synthetic Quartz + quartz: { + 950: '#F7EBFA', + 900: '#EFD6F5', + 800: '#DDACEA', + 700: '#CE85E0', + 600: '#BD5DD5', + 500: '#AD34CB', + 400: '#8A2AA2', + 300: '#681F7A', + 200: '#451551', + 150: '#34103D', + }, + // Evolved synthetic quartz + 'evolved-quartz': { + 500: '#C40DF2', + 700: '#DC6EF7', + 900: '#F3CFFC', + }, + // Acrylic Blue + blue: { + 950: '#E9EDFC', + 900: '#D2DBF9', + 800: '#A4B5F2', + 700: '#7992EC', + 600: '#4D6EE5', + 500: '#204ADF', + 400: '#193BB2', + 300: '#132C86', + 200: '#0D1D59', + 150: '#0A1643', + }, + // Evolved Acrylic Blue + 'evolved-blue': { + 500: '#0039FF', + }, + // Safety Green + success: { + 950: '#E7FEE9', + 300: '#089113', + 200: '#05610C', + 150: '#044909', + }, + // Safety Red + danger: { + 950: '#FFE5E5', + 500: '#FF0000', + 350: '#B30000', + }, + }, + fontSize: { + // rem values calculated with a base font of 16px + caption: ['0.75rem', { letterSpacing: '-0.01em', lineHeight: '136%' }], // 12px - Caption + 'label-sm': ['0.625rem', { letterSpacing: '0.04em', lineHeight: '136%' }], // 10px - Small Label + label: ['0.75rem', { letterSpacing: '0.04em', lineHeight: '136%' }], // 12px - Label + overline: ['0.875rem', { letterSpacing: '0.04em', lineHeight: '136%' }], // 14px - Overline + 'p-xs': ['0.625rem', { letterSpacing: '0.0025em', lineHeight: '150%' }], // 10px - XSmall Paragraph + 'p-sm': ['0.75rem', { letterSpacing: '-0.01em', lineHeight: '150%' }], // 12px - Small Paragraph + p: ['0.875rem', { letterSpacing: '0.0025em', lineHeight: '150%' }], // 14px - Paragraph + 'p-lg': ['1rem', { letterSpacing: '0em', lineHeight: '150%' }], // 16px - Large Paragraph + code: ['1rem', { letterSpacing: '0.03em', lineHeight: '136%' }], // 16px - Code + 'code-sm': ['0.75rem', { letterSpacing: '0.03em', lineHeight: '136%' }], // 12px - Small Code + // Headings + logo: ['1.5rem', { letterSpacing: '0em', lineHeight: '100%' }], // 24px - Logo Application + 'h5-m': ['1.125rem', { letterSpacing: '0em', lineHeight: '136%' }], // 18px - Mobile Heading 5 + h5: ['1.3125rem', { letterSpacing: '0em', lineHeight: '136%' }], // 21px - Desktop Heading 5 + 'h4-m': ['1.3125rem', { letterSpacing: '0em', lineHeight: '136%' }], // 21px - Mobile Heading 4 + h4: ['1.75rem', { letterSpacing: '0em', lineHeight: '136%' }], // 28px - Desktop Heading 4 + 'h3-m': ['1.75rem', { letterSpacing: '0em', lineHeight: '136%' }], // 28px - Mobile Heading 3 + h3: ['2.375rem', { letterSpacing: '0em', lineHeight: '120%' }], // 38px - Desktop Heading 3 + 'h2-m': ['2.375rem', { letterSpacing: '0em', lineHeight: '120%' }], // 38px - Mobile Heading 2 + h2: ['3.1875rem', { letterSpacing: '0em', lineHeight: '116%' }], // 51px - Desktop Heading 2 + 'h1-m': ['3.1875rem', { letterSpacing: '0em', lineHeight: '116%' }], // 51px - Mobile Heading 1 + h1: ['4.1875rem', { letterSpacing: '0em', lineHeight: '116%' }], // 67px - Desktop Heading 1 + 'icon-sm': ['12px', { lineHeight: '100%' }], + 'icon-md': ['16px', { lineHeight: '100%' }], + 'icon-lg': ['24px', { lineHeight: '100%' }], + 'icon-xl': ['36px', { lineHeight: '100%' }], + }, + fontFamily: { + body: ['CohereText', 'Arial', ...defaultTheme.fontFamily.sans], + variable: ['CohereVariable', 'Arial', ...defaultTheme.fontFamily.serif], + code: ['CohereMono', ...defaultTheme.fontFamily.mono], + iconOutline: ['CohereIconOutline'], + iconDefault: ['CohereIconDefault'], + }, + fontWeight: { + // Bolded fonts will always use Cohere Variable with the weight 525 + medium: '525', + }, + }, + }, +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/types/index.d.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/types/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cf747cbbbe71a1f3e4f14ddaddc0d477f83734aa --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/types/index.d.ts @@ -0,0 +1,43 @@ +type Nullable = T | null; + +declare module 'js-resume-parser' { + export function getDataFromPDF(file: File): Promise<{ text: string }>; + export function getDataFromDocx(file: File): Promise<{ text: string }>; +} + +// from https://github.com/compulim/react-scroll-to-bottom/issues/81 with additions +declare module 'react-scroll-to-bottom' { + import * as React from 'react'; + + interface ReactScrollToBottomProps { + checkInterval?: number; + className?: string; + debounce?: number; + followButtonClassName?: string; + mode?: string; + scrollViewClassName?: string; + children: React.ReactNode; + debug?: boolean; + initialScrollBehavior?: 'smooth' | 'auto'; + } + + interface ScrollOptions { + behavior: ScrollBehavior; + } + + interface FunctionContextProps { + scrollTo: (scrollTo: number, options: ScrollOptions) => void; + scrollToBottom: (options: ScrollOptions) => void; + scrollToEnd: (options: ScrollOptions) => void; + scrollToStart: (options: ScrollOptions) => void; + scrollToTop: (options: ScrollOptions) => void; + } + + export const useScrollToBottom: () => FunctionContextProps.scrollToBottom; + export const useAtTop: () => [boolean]; + export const useSticky: () => [boolean]; + + const FunctionContext: React.Context; + + export default class ScrollToBottom extends React.PureComponent {} +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/types/message.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/types/message.ts new file mode 100644 index 0000000000000000000000000000000000000000..4a33a75a5fa25a9cfb70d1db5f72c31825a4cda9 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/types/message.ts @@ -0,0 +1,167 @@ +import { + Citation, + ListConversationFile, + StreamToolCallsGeneration, + StreamToolInput, +} from '@/cohere-client'; + +export enum BotState { + LOADING = 'loading', + TYPING = 'typing', + FULFILLED = 'fulfilled', + ERROR = 'error', + ABORTED = 'aborted', +} + +export enum MessageType { + BOT = 'bot', + USER = 'user', +} + +type BaseMessage = { + type: MessageType; + text: string; + error?: string; +}; + +/** + * This is a bot-only state for all past bot messages that have been returned from the server. + */ +export type FulfilledMessage = BaseMessage & { + type: MessageType.BOT; + state: BotState.FULFILLED; + /** + * Unique Id per generation for given responseId + * A responseId can have multiple generations + */ + generationId: string; + /* This id links a particular message to a piece of feedback given by the user. */ + feedbackId?: string; + goodResponse?: boolean; + citations?: Citation[]; + isRAGOn?: boolean; + originalText: string; + toolEvents?: StreamToolCallsGeneration[]; +}; + +/** + * This is a bot-only state for when a message is aborted. + */ +export type AbortedMessage = BaseMessage & { + type: MessageType.BOT; + state: BotState.ABORTED; + toolEvents?: StreamToolCallsGeneration[]; +}; + +/** + * This is a bot-only state for when we wait for the bot's first token to arrive. + */ +export type LoadingMessage = BaseMessage & { + type: MessageType.BOT; + state: BotState.LOADING; + isRAGOn?: boolean; +}; + +/** + * This is a bot-only state for when we are streaming in tokens. + */ +export type TypingMessage = BaseMessage & { + type: MessageType.BOT; + state: BotState.TYPING; + generationId: string; + originalText: string; + citations?: Citation[]; + isRAGOn?: boolean; + toolEvents?: StreamToolCallsGeneration[]; +}; + +/** + * This is a bot-only state for when there is an error from the server. + */ +export type ErrorMessage = BaseMessage & { + type: MessageType.BOT; + state: BotState.ERROR; + toolEvents?: StreamToolInput[]; +}; + +/** + * Message sent from the user. + */ +export type UserMessage = BaseMessage & { + type: MessageType.USER; + files?: ListConversationFile[]; +}; + +export type ChatMessage = UserMessage | BotMessage; + +export type BotMessage = + | LoadingMessage + | TypingMessage + | FulfilledMessage + | ErrorMessage + | AbortedMessage; + +export type StreamingMessage = FulfilledMessage | TypingMessage | LoadingMessage; + +export const isUserMessage = (message: ChatMessage): message is UserMessage => { + return message.type === MessageType.USER; +}; + +export const isFulfilledMessage = (message: ChatMessage): message is FulfilledMessage => { + return message.type === MessageType.BOT && message.state === BotState.FULFILLED; +}; + +export const isErroredMessage = (message: ChatMessage): message is ErrorMessage => { + return message.type == MessageType.BOT && message.state === BotState.ERROR; +}; + +export const isTypingMessage = (message: ChatMessage): message is TypingMessage => { + return message.type === MessageType.BOT && message.state === BotState.TYPING; +}; + +export const isLoadingMessage = (message: ChatMessage): message is TypingMessage => { + return message.type === MessageType.BOT && message.state === BotState.LOADING; +}; + +export const isAbortedMessage = (message: ChatMessage): message is AbortedMessage => { + return message.type === MessageType.BOT && message.state === BotState.ABORTED; +}; + +export const isFulfilledOrTypingMessage = ( + message: ChatMessage +): message is FulfilledMessage | TypingMessage => { + return isFulfilledMessage(message) || isTypingMessage(message); +}; + +export const isFulfilledOrTypingMessageWithCitations = ( + m: ChatMessage +): m is FulfilledMessage | (TypingMessage & Required>) => + m && isFulfilledOrTypingMessage(m) && !!m.citations && m.citations.length > 0; + +export const createErrorMessage = (message: Omit): ErrorMessage => { + return { + ...message, + type: MessageType.BOT, + state: BotState.ERROR, + }; +}; + +export const createAbortedMessage = ( + message: Omit +): AbortedMessage => { + return { + ...message, + type: MessageType.BOT, + state: BotState.ABORTED, + }; +}; + +export const createLoadingMessage = ( + message: Omit +): LoadingMessage => { + return { + ...message, + type: MessageType.BOT, + state: BotState.LOADING, + }; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/types/tools.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/types/tools.ts new file mode 100644 index 0000000000000000000000000000000000000000..92376f3c06376cb13021a7ae60ebff05cdf45ae6 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/types/tools.ts @@ -0,0 +1,6 @@ +export type GoogleDriveToolArtifact = { + type: string; + id: string; + name: string; + url: string; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/types/util.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/types/util.ts new file mode 100644 index 0000000000000000000000000000000000000000..e7c8547ab0123c4f9020add96d1c3a1abf043bba --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/types/util.ts @@ -0,0 +1,3 @@ +export type NoNullProperties = { + [Property in keyof Type]-?: NonNullable; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/citations.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/citations.ts new file mode 100644 index 0000000000000000000000000000000000000000..d5a5d5370c3f8efe77f4d3de6b405b85d0e71526 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/citations.ts @@ -0,0 +1,76 @@ +import { Citation } from '@/cohere-client'; +import { DYNAMIC_STRINGS } from '@/constants/strings'; + +/** + * @description Helper function to temporarily ensure markdown image syntax provided by the model is correct. + * This is a temporary fix as the current model is consistently returning incorrect markdown image syntax. + * @param text - message text or citation text + */ +export const fixMarkdownImagesInText = (text: string) => { + return text.replace('! [', '!['); +}; + +const formatter = new Intl.ListFormat('en', { style: 'long', type: 'conjunction' }); + +/** + * Replace text string with citations following the format: + * :cite[]{generationId="" start="" end""} + * @param text + * @param citations + * @param generationId + * @returns text with citations + */ +export const replaceTextWithCitations = ( + text: string, + citations: Citation[], + generationId: string +) => { + if (!citations.length || !generationId) return text; + let replacedText = text; + + let lengthDifference = 0; // Track the cumulative length difference + let notFoundReferences: string[] = []; + citations.forEach(({ start = 0, end = 0, text: citationText }, index) => { + const citeStart = start + lengthDifference; + const citeEnd = end + lengthDifference; + + // if citeStart is higher than the length of the text, add it to the bottom of the text as "Reference #n" + if (start >= text.length || isReferenceBetweenIframes(replacedText, start)) { + const ref = DYNAMIC_STRINGS.referenceNumber(index + 1); + notFoundReferences.push( + `:cite[${ref}]{generationId="${generationId}" start="${start}" end="${end}"}` + ); + return; + } + + const fixedText = fixMarkdownImagesInText(citationText); + + // Encode the citationText in case there are any weird characters or unclosed brackets that will + // interfere with parsing the markdown. However, let markdown images through so they may be properly + // rendered. + const isMarkdownImage = fixedText.match(/!\[.*\]\(.*\)/); + const encodedCitationText = isMarkdownImage ? fixedText : encodeURIComponent(fixedText); + const citationId = `:cite[${encodedCitationText}]{generationId="${generationId}" start="${start}" end="${end}"}`; + + replacedText = replacedText.slice(0, citeStart) + citationId + replacedText.slice(citeEnd); + lengthDifference += citationId.length - (citeEnd - citeStart); + }); + + const references = DYNAMIC_STRINGS.fromReferences(formatter.format(notFoundReferences)); + if (notFoundReferences.length > 0) { + return references + '\n' + replacedText; + } + return replacedText; +}; + +export const createStartEndKey = (start: number | string, end: number | string) => + `${start}-${end}`; + +function isReferenceBetweenIframes(replacedText: string, citeStart: number): boolean { + const IFRAME_REGEX = //g; + const match = IFRAME_REGEX.exec(replacedText); + + if (!match) return false; + + return match.index < citeStart && citeStart < match.index + match[0].length; +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/cn.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/cn.ts new file mode 100644 index 0000000000000000000000000000000000000000..9ccb8a270cff77331ec0f52993c86a68642992c8 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/cn.ts @@ -0,0 +1,89 @@ +import cx from 'classnames'; +import { extendTailwindMerge } from 'tailwind-merge'; + +const customTwMerge = extendTailwindMerge({ + // @see: https://github.com/dcastil/tailwind-merge/blob/v1.14.0/docs/configuration.md#class-groups + classGroups: { + 'font-size': [ + { + text: [ + 'caption', + 'label-sm', + 'label', + 'overline', + 'p-xs', + 'p-sm', + 'p', + 'p-lg', + 'code', + 'logo', + 'h5', + 'h5-m', + 'h4', + 'h4-m', + 'h3', + 'h3-m', + 'h2', + 'h2-m', + 'h1', + 'h1-m', + ], + }, + ], + 'min-w': [ + { + 'min-w': [ + 'citation-panel-md', + 'citation-panel-lg', + 'citation-panel-xl', + 'menu', + 'left-panel-lg', + 'left-panel-2xl', + 'left-panel-3xl', + ], + }, + ], + 'max-w': [ + { + 'max-w': [ + 'modal-xs', + 'modal-sm', + 'modal-md', + 'modal', + 'modal-lg', + 'modal-xl', + 'container', + 'page', + 'drawer', + 'drawer-lg', + ], + }, + ], + z: [{ z: ['navigation', 'modal', 'dropdown', 'toast'] }], + w: [ + { + w: [ + 'modal', + 'ep-icon-sm', + 'ep-icon-md', + 'ep-icon-lg', + 'ep-icon-xl', + 'btn-sm', + 'btn-md', + 'btn-lg', + 'btn-xl', + ], + }, + ], + h: [{ h: ['ep-icon-sm', 'ep-icon-md', 'ep-icon-lg', 'ep-icon-xl'] }], + 'max-h': [{ 'max-h': ['cell-xs', 'cell-sm', 'cell-md', 'cell-lg', 'cell-xl'] }], + 'min-h': [{ 'min-h': ['cell-xs', 'cell-sm', 'cell-md', 'cell-lg', 'cell-xl'] }], + }, +}); + +/** + * Combines classnames with tailwind-merge + */ +export function cn(...inputs: cx.ArgumentArray) { + return customTwMerge(cx(inputs)); +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/conversation.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/conversation.ts new file mode 100644 index 0000000000000000000000000000000000000000..d9f55c605a1f04dc4a3d17d38a49760e334b635d --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/conversation.ts @@ -0,0 +1,83 @@ +import { Message, MessageAgent } from '@/cohere-client'; +import { BotState, ChatMessage, FulfilledMessage, MessageType, UserMessage } from '@/types/message'; +import { replaceTextWithCitations } from '@/utils/citations'; +import { replaceCodeBlockWithIframe } from '@/utils/preview'; + +/** + * A utility function that checks if the conversation title should be updated + * Based on: + * - It has only two messages, one from the user and one from the bot. + * - If ~5 turns have passed, meaning every 5 messages from the bot. + * - Note: the bot can fail to respond and these turns can become out of sync but 5 bot messages + * implies that there were at least 5 matching user messages (user message === request, bot message === response pairs) + * @param messages - The messages array + * */ +export const shouldUpdateConversationTitle = (messages: ChatMessage[]) => { + const numUserMessages = messages.filter( + (message) => message.type === MessageType.USER && !message.error + ).length; + const numBotMessages = messages.filter( + (message) => message.type === MessageType.BOT && message.state === BotState.FULFILLED + ).length; + + if (numUserMessages === 1 && numBotMessages === 1) { + return true; + } + + return numBotMessages % 5 === 0; +}; + +export type UserOrBotMessage = UserMessage | FulfilledMessage; + +/** + * @description Maps chat history given by the API to a list of messages that can be displayed in the chat. + */ +export const mapHistoryToMessages = (history?: Message[]): UserOrBotMessage[] => { + if (!history) return []; + + let messages: UserOrBotMessage[] = []; + let tempToolEvents: FulfilledMessage['toolEvents']; + + for (const message of history) { + if (message.agent === MessageAgent.CHATBOT) { + if (!message.tool_plan) { + messages.push({ + type: MessageType.BOT, + state: BotState.FULFILLED, + originalText: message.text ?? '', + text: replaceTextWithCitations( + replaceCodeBlockWithIframe(message.text) ?? '', + message.citations ?? [], + message.generation_id ?? '' + ), + generationId: message.generation_id ?? '', + citations: message.citations, + toolEvents: tempToolEvents, + }); + tempToolEvents = undefined; + } else { + // Historical tool events come in as chatbot messages before the actual final response message. + if (tempToolEvents) { + tempToolEvents.push({ + text: message.tool_plan, + tool_calls: message.tool_calls, + }); + } else { + tempToolEvents = [{ text: message.tool_plan, tool_calls: message.tool_calls }]; + } + } + } else { + messages.push({ + type: MessageType.USER, + text: replaceTextWithCitations( + message.text ?? '', + message.citations ?? [], + message.generation_id ?? '' + ), + files: message.files, + }); + } + } + + return messages; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/delimiters.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/delimiters.ts new file mode 100644 index 0000000000000000000000000000000000000000..c220df1818f0ecc1f3328163e12d5a1dffb24c95 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/delimiters.ts @@ -0,0 +1,6 @@ +/** + * Simple helper to check if a string has common delimiters. For now this is only looking for commas. + */ +export const hasCommonDelimiters = (str: string): boolean => { + return str.includes(','); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/download.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/download.ts new file mode 100644 index 0000000000000000000000000000000000000000..15e4e153e343ff2f9c42fe2296991487d099d223 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/download.ts @@ -0,0 +1,72 @@ +export type StructuredTable = { + header: string[]; + rows: string[][]; +}; + +/** + * A client-side function that triggers a file download in the user's browser. + * Note: This creates a temporary tag in the document body and simulates a click on it which may not always work + * https://stackoverflow.com/questions/50694881/how-to-download-file-in-react-js/50695407#50695407 + * + * @param fileName The name of the file + * @param parts Data that will comprise the file + * @param type MIME-type of the data + * + * @returns True If the download was successful, else False + */ +export function downloadFile( + fileName: string, + parts: BlobPart[], + type: string = 'text/plain' +): boolean { + if (window === null || window === undefined || document === null || document === undefined) { + return false; + } + + const file = new File(parts, fileName, { type: type }); + const link = document.createElement('a'); + const url = URL.createObjectURL(file); + + try { + link.href = url; + link.download = file.name; + document.body.appendChild(link); + link.click(); + // schedule a removal in the next event loop + setTimeout(() => { + document.body.removeChild(link); + window.URL.revokeObjectURL(url); + }, 0); + } catch (e) { + return false; + } + + return true; +} + +/** + * Converts an object of type StructuredTable into a string representation of an XSV + * + * Ex 1: Using the delimiter ',' will result in a CSV file (comma seperated) + * Ex 2: Using the delimiter '\t' will result in a TSV file (tab seperated) + * @param table An object of type StructuredTable + * @param delimiter A delimiter for the XSV (ex: ',' or '\t') + */ +export function structuredTableToXSV( + table: StructuredTable | null, + delimiter: string = ',' +): string | null { + if (!table || table.header.length === 0 || table.rows.length === 0) return null; + + let xsv = ''; + table.header.forEach( + (txt, i) => (xsv += `"${txt}"${i < table.header.length - 1 ? delimiter : ''}`) + ); + xsv += '\n'; + table.rows.forEach((row) => { + row.forEach((txt, i) => (xsv += `"${txt}"${i < row.length - 1 ? delimiter : ''}`)); + xsv += '\n'; + }); + + return xsv; +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/error.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/error.ts new file mode 100644 index 0000000000000000000000000000000000000000..eafbbebfa6555a8ca1b2720145a2a55b92ab4257 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/error.ts @@ -0,0 +1,30 @@ +import { CohereNetworkError } from '@/cohere-client'; + +export const isAbortError = (error: unknown) => { + return error instanceof DOMException && error.name === 'AbortError'; +}; + +export const isShareLinkExpiredError = (error: unknown): error is CohereNetworkError => + error instanceof CohereNetworkError && + error.status === 404 && + error.message === 'snapshot link has expired'; + +/** + * Wraps a promise and always returns an array with the first element being the data and the second element the error. + * If the promise errors out, the data element will be null while the error element while have a value (and vice-versa). + * @param promiseVar A promise + * + * @example + * let [data, err] = await safeAsync(GetSomeData()); + * if (err === null) { + * useTheData(data); + * } + */ +export async function safeAsync(promiseVar: Promise): Promise<[T | null, Error | null]> { + try { + const data = await promiseVar; + return [data, null]; + } catch (e) { + return [null, e as Error]; + } +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/file.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/file.ts new file mode 100644 index 0000000000000000000000000000000000000000..0e926d7ad2e3c4e8e0dbed85c534fb954fb87ba1 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/file.ts @@ -0,0 +1,46 @@ +import { FILE_TOOL_CATEGORY, ToolDefinition } from '@/cohere-client'; + +/** + * Gets the file extension from its name. + * @param filename + * @returns file extension e.g. .pdf or .txt + */ +export const getFileExtension = (filename: string): string | undefined => { + const ext = filename.split('.').pop(); + return ext ? `.${ext}` : undefined; +}; + +/** + * Generate a random number between min and max. + * @param min + * @param max + * @returns random number between min and max + */ +export const getRandomNumberInBetween = (min: number, max: number) => { + return Math.floor(Math.random() * (max - min) + min); +}; + +/** + * Estimate the upload time in ms based on the file size. + * This equation estimates upload speed using a least squares regression of some existing data points with various file sizes. + * 18MB, 60 seconds, + * 12MB, 45 seconds, + * 8.7MB, 32 seconds, + * 6MB, 23 seconds, + * 4.3MB, 12 seconds, + * 1.9MB, 4.8 seconds, + * 1.1MB, 3 seconds, + * 350KB, 1.51 seconds + * @param fileSizeInBytes + * @returns random number between min and max + */ +export const getFileUploadTimeEstimateInMs = (fileSizeInBytes: number) => { + // This equation estimates upload speed based on some existing data points with various file sizes. + return ((3.51 * fileSizeInBytes) / 1000000 - 0.3) * 1000; +}; + +/** + * @description Determines if a tool is the default file loader tool. + */ +export const isDefaultFileLoaderTool = (t: ToolDefinition) => + t.category === FILE_TOOL_CATEGORY && t.is_visible; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/format.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/format.ts new file mode 100644 index 0000000000000000000000000000000000000000..c4630462bfda5a0a8d188d82377e79b4bc658450 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/format.ts @@ -0,0 +1,51 @@ +import { DYNAMIC_STRINGS } from '@/constants/strings'; +import { pluralize } from '@/utils'; + +const WEEK_IN_MILLIS = 7 * 24 * 60 * 60 * 1000; + +/** + * Returns the number of weeks ago and a string representation of the number of weeks ago. + */ +export const getWeeksAgo = (date: string | Date): { weeksAgo: number; weeksAgoStr: string } => { + const now = new Date(); + const diffInMillis = now.getTime() - new Date(date).getTime(); + const weeksAgo = Math.floor(diffInMillis / WEEK_IN_MILLIS); + const weeksAgoStr = DYNAMIC_STRINGS.weeksAgo(weeksAgo); + + return { + weeksAgo, + weeksAgoStr, + }; +}; + +/** + * Converts a file size in megabytes to bytes + */ +export const fileSizeToBytes = (size: number): number => { + return size * 1024 * 1024; +}; + +/** + * Converts a file size in bytes to megabytes + * */ +export const fileSizeToMB = (size: number): number => { + return size / 1024 / 1024; +}; + +/** + * Returns file size with units e.g. 10 bytes, 10 KB, 10 MB + * Only works for bytes, KB, and MB + * Add additional units as needed + */ +export const formatFileSize = (bytes: number): string => { + const kb = 1024; + const mb = kb * 1024; + + if (bytes < kb) { + return DYNAMIC_STRINGS.numBytes(bytes); + } else if (bytes < mb) { + return DYNAMIC_STRINGS.numKB((bytes / kb).toFixed(1)); + } else { + return DYNAMIC_STRINGS.numMB((bytes / mb).toFixed(1)); + } +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/getCohereColor.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/getCohereColor.ts new file mode 100644 index 0000000000000000000000000000000000000000..7f62eae73895ece98a2bcda564a37f439cd8e614 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/getCohereColor.ts @@ -0,0 +1,38 @@ +const BG_COLOR_LIST = [ + 'bg-quartz-700', + 'bg-green-600', + 'bg-coral-500', + 'bg-quartz-700', + 'bg-green-250', + 'bg-coral-700', +]; + +const TEXT_COLOR_LIST = [ + 'text-quartz-700', + 'text-green-600', + 'text-coral-500', + 'text-quartz-700', + 'text-green-250', + 'text-coral-700', +]; + +/** + * @description Get a color from the Cohere color palette, when no index is provided, a random color is returned + * @param id - id for generating a constant color in the palette + * @param background - if true, returns a background color, otherwise returns a text color + * @returns color from the Cohere color palette + */ +export const getCohereColor = ( + id?: string, + options: { background?: boolean } = { background: true } +) => { + const COLOR_LIST = options?.background ? BG_COLOR_LIST : TEXT_COLOR_LIST; + if (id === undefined) { + const randomIndex = Math.floor(Math.random() * COLOR_LIST.length); + + return COLOR_LIST[randomIndex]; + } + const idNumber = id.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0); + const index = idNumber % COLOR_LIST.length; + return COLOR_LIST[index]; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/grounding.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/grounding.ts new file mode 100644 index 0000000000000000000000000000000000000000..9632269d2083038889a830cec965626af9c204f4 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/grounding.ts @@ -0,0 +1,9 @@ +import { Tool } from '@/cohere-client'; + +/** + * Helper function to determine if grounding is on. + * Note: this doesn't mean that RAG was used, just that it's on. + */ +export const isGroundingOn = (tools: Tool[], documents: string[]) => { + return tools.length > 0 || documents.length > 0; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/index.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..7093eb3db06ee23795162ae4a0180d34b9c13129 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/index.ts @@ -0,0 +1,12 @@ +export * from './citations'; +export * from './cn'; +export * from './conversation'; +export * from './delimiters'; +export * from './error'; +export * from './file'; +export * from './format'; +export * from './grounding'; +export * from './pluralize'; +export * from './queryString'; +export * from './simpleEmailValidation'; +export * from './urls'; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/pluralize.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/pluralize.ts new file mode 100644 index 0000000000000000000000000000000000000000..4c95511dfd2862e44db2078564cd77045eddf27a --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/pluralize.ts @@ -0,0 +1,8 @@ +export const pluralize = (text: string, quantity: number, customPluralization?: string) => { + const isPlural = quantity > 1 || quantity === 0; + if (customPluralization) { + return isPlural ? customPluralization : text; + } + const pluralization = text.endsWith('s') ? 'es' : 's'; + return `${text}${isPlural ? pluralization : ''}`; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/preview.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/preview.ts new file mode 100644 index 0000000000000000000000000000000000000000..d89e57fa82c8af9dd38ffade1fe56f3444127c0f --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/preview.ts @@ -0,0 +1,93 @@ +/** + * Adds an onError event to all img elements in the html string + * @param html + * @returns + */ +const addOnErrorToImg = (html: string) => { + const regex = //g; + const imgElements = html.match(regex); + if (imgElements) { + for (let i = 0; i < imgElements.length; i++) { + const imgElement = imgElements[i]; + let newImgElement = imgElement; + if (imgElement.endsWith('/>')) { + newImgElement = imgElement.replace('/>', ' onError="onImageError(this)"/>'); + } else { + newImgElement = imgElement.replace('>', ' onError="onImageError(this)">'); + } + html = html.replace(imgElement, newImgElement); + } + } + html = html + GET_IMAGE_DEF; + return html; +}; + +const GET_IMAGE_DEF = ` + +`; + +/** + * Reconstructs the html from the plain string + * @param rawHTML + * @returns + */ +const getReconstructedHtml = (rawHTML: string) => { + const htmlRegex = /```(?:html)\n([\s\S]*?)(```|$)/; + const jsRegex = /```(?:js)\n([\s\S]*?)```/; + const cssRegex = /```(?:css)\n([\s\S]*?)```/; + + const code = rawHTML.match(htmlRegex); + + let html = ''; + if (code) { + html = code[1]; + const cssCode = rawHTML.match(cssRegex); + let css = ''; + if (cssCode) { + css = cssCode[1]; + html = `` + html; + } + + const jsCode = rawHTML.match(jsRegex); + let js = ''; + if (jsCode) { + js = jsCode[1]; + html = html + ``; + } + } + return html; +}; + +// removes all the added code blocks and returns the original html +export const cleanupCodeBlock = (content: string) => { + const imgRegex = / onError="onImageError\(this\)"/g; + const cleanContent = content.replace(GET_IMAGE_DEF, '').replace(imgRegex, ''); + + return cleanContent; +}; + +export const replaceCodeBlockWithIframe = (content: string) => { + const matchingRegex = /```html([\s\S]+)/; + const replacingRegex = /```html([\s\S]+?)(```|$)/; + + const match = content.match(matchingRegex); + + if (!match) { + return content; + } + + const html = addOnErrorToImg(getReconstructedHtml(content)); + + const blob = new Blob([html], { type: 'text/html' }); + const src = URL.createObjectURL(blob); + const iframe = ``; + + content = content.replace(replacingRegex, iframe); + + return content; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/queryString.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/queryString.ts new file mode 100644 index 0000000000000000000000000000000000000000..64faf8b36bc2ae80edcb64637bd7ed909171de15 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/queryString.ts @@ -0,0 +1,14 @@ +/** + * Get the query param as a string to avoid the usual + * Array.isArray(router.query.[param]) + * ? router.query.[param][0] + * : router.query.[param]; + */ + +export const getQueryString = (param?: string | string[] | null) => { + if (!param) return; + if (Array.isArray(param)) { + return param[0] as string; + } + return param as string; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/simpleEmailValidation.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/simpleEmailValidation.ts new file mode 100644 index 0000000000000000000000000000000000000000..44a5cbc585fdb4ab7d901b6da6a30d763f9fce02 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/simpleEmailValidation.ts @@ -0,0 +1,19 @@ +// Validates email address complies with the spec at https://tools.ietf.org/html/rfc5322#section-3.4.1 +// local-part "@" domain +// where local-part and domains are each 64 characters or less + +export const simpleEmailValidation = (email: string) => { + const emailRegex = + /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + const isPotentiallyValid = emailRegex.test(email); + if (!isPotentiallyValid) { + return false; + } + + const parts = email.split('@'); + if (parts.length !== 2) { + return false; + } + const [before, after] = parts; + return before.length > 0 && before.length <= 64 && after.length > 0 && after.length <= 64; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/tools.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/tools.ts new file mode 100644 index 0000000000000000000000000000000000000000..959e0f6753c9e32737e99d792873a78441adcd14 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/tools.ts @@ -0,0 +1,78 @@ +import { Document } from '@/cohere-client'; + +type PythonInterpreterFieldsBase = { + snippet?: string; // citation snippet, will either be the stdout, stderr, or the file name +}; + +type PythonInterpreterImageFields = { + /** + * String representation of a json object with the following fields: + * - filename: string + * - b64_data: string + */ + output_file?: string; +}; + +type PythonInterpreterCodeFields = { + code_runtime?: string; + success?: string; // "True" or "False" + std_out?: string; + std_err?: string; + /** + * String representation of a json object with the following fields: + * - type: string (e.g. "ZeroDivisionError") + * - message: string (usually a stack trace) + */ + error?: string; +}; + +type PythonInterpreterFields = PythonInterpreterFieldsBase & + PythonInterpreterImageFields & + PythonInterpreterCodeFields; + +export type PythonInterpreterOutputFile = { filename: string; b64_data: string }; +export type PythonInterpreterCodeError = { type: string; message: string }; + +export const parsePythonInterpreterToolFields = (document: Document) => { + if (!document.fields) { + return { + snippet: undefined, + success: undefined, + codeRuntime: undefined, + stdErr: undefined, + stdOut: undefined, + error: undefined, + outputFile: undefined, + }; + } + + const fields = document.fields as PythonInterpreterFields; + let outputFile: PythonInterpreterOutputFile | undefined; + let error: PythonInterpreterCodeError | undefined; + + if (fields.output_file) { + try { + outputFile = JSON.parse(fields.output_file); + } catch (e) { + console.error('Could not parse output_file', e); + } + } + + if (fields.error) { + try { + error = JSON.parse(fields.error); + } catch (e) { + console.error('Could not parse error', e); + } + } + + return { + snippet: fields.snippet, + success: fields.success ? fields.success.toLowerCase() === 'true' : undefined, + codeRuntime: fields.code_runtime, + stdErr: fields.std_err, + stdOut: fields.std_out, + error, + outputFile, + }; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/urls.ts b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/urls.ts new file mode 100644 index 0000000000000000000000000000000000000000..692a16c92d30c0598926d0f19648f8243aedc193 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/src/utils/urls.ts @@ -0,0 +1,79 @@ +import { ParseResultType, parseDomain } from 'parse-domain'; + +/** + * Returns the domain name of a url. + * * e.g. https://www.google.com -> google + * * e.g. https://www.google.co.uk -> google + * * e.g. https://www.en.wikipedia.co.uk/search?q=hello -> wikipedia + * * e.g. https://www.cloud.console.aws.amazon.co.uk -> amazon + */ +export const getWebDomain = (url?: string) => { + if (!url) return ''; + + try { + const urlObj = new URL(url); + + const parsed = parseDomain(urlObj.hostname); + + if (parsed.type === ParseResultType.Listed) { + return parsed.domain; + } + + return ''; + } catch { + return ''; + } +}; + +/** + * Returns the url if it is valid and safe. + * * e.g. https://www.google.com -> ok + * * e.g. alert('hi') -> not ok, return undefined + * * e.g. https://www.google.com?q= -> ok, return encoded url + */ +export const getSafeUrl = (url?: string) => { + if (!url) return undefined; + + try { + const urlObj = new URL(url); + const parsed = parseDomain(urlObj.hostname); + + if (parsed.type === ParseResultType.Listed) { + const encodedPathname = urlObj.pathname + .split('/') + .map((p) => encodeURIComponent(p)) + .join('/'); + + const encodedSearchParamsList = []; + for (const [key, value] of urlObj.searchParams) { + encodedSearchParamsList.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`); + } + const encodedSearchParams = + encodedSearchParamsList.length > 0 ? `?${encodedSearchParamsList.join('&')}` : ''; + + return `${urlObj.origin}${encodedPathname}${encodedSearchParams}${urlObj.hash}`; + } + + return undefined; + } catch { + return undefined; + } +}; + +/** + * Returns the url if it is valid. + * * e.g. https://www.google.com -> ok + * * e.g. alert('hi') -> not ok, return undefined + * + * @param url The url to validate. + * @returns The url if it is valid, otherwise undefined. + */ +export const getValidURL = (url?: string | null) => { + if (!url) return undefined; + try { + new URL(url); + return url; + } catch { + return undefined; + } +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/tailwind.config.js b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/tailwind.config.js new file mode 100644 index 0000000000000000000000000000000000000000..90daaa06c937df9e30dde95be046621f2fabe0e8 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/tailwind.config.js @@ -0,0 +1,172 @@ +/** @type {import('tailwindcss').Config} */ +module.exports = { + presets: [require('./src/themes/cohereTheme')], + content: ['src/**/*.{js,jsx,ts,tsx}'], + plugins: [require('@tailwindcss/typography')], + darkMode: 'selector', + theme: { + extend: { + screens: { + '3xl': '2000px', + }, + minWidth: { + 'citation-panel-md': '259px', // subtract 10px for scrollbar and 1px for border + 'citation-panel-lg': '325px', // subtract 10px for scrollbar and 1px for border + 'citation-panel-xl': '349px', // subtract 10px for scrollbar and 1px for border + menu: '174px', + 'agents-panel-collapsed': '82px', + 'agents-panel-expanded': '288px', + 'agents-panel-expanded-lg': '320px', + 'left-panel-lg': '242px', + 'left-panel-2xl': '300px', + 'left-panel-3xl': '360px', + }, + width: { + 'ep-icon-sm': '12px', + 'ep-icon-md': '16px', + 'ep-icon-lg': '24px', + 'ep-icon-xl': '36px', + 'btn-sm': '280px', + 'btn-md': '312px', + 'btn-lg': '350px', + 'btn-xl': '370px', + modal: '648px', + toast: '320px', + 'toast-sm': '280px', + 'citation-md': '250px', + 'citation-lg': '298px', + 'citation-xl': '320px', + file: '224px', + 'edit-agent-panel': '350px', + 'edit-agent-panel-lg': '683px', + 'edit-agent-panel-2xl': '800px', + }, + maxWidth: { + 'modal-xs': '352px', + 'modal-sm': '463px', + 'modal-md': '476px', + modal: '648px', + 'modal-lg': '1062px', + 'modal-xl': '1600px', + message: '976px', + 'agents-panel-collapsed': '82px', + 'agents-panel-expanded': '288px', + 'agents-panel-expanded-lg': '320px', + drawer: '288px', + 'drawer-lg': '360px', + 'left-panel-lg': '242px', + 'left-panel-2xl': '300px', + 'left-panel-3xl': '360px', + 'share-content': '700px', + 'share-content-with-citations': '1500px', + }, + height: { + 'ep-icon-sm': '12px', + 'ep-icon-md': '16px', + 'ep-icon-lg': '24px', + 'ep-icon-xl': '36px', + header: '64px', + }, + minHeight: { + 'cell-xs': '24px', + 'cell-sm': '32px', + 'cell-md': '40px', + 'cell-lg': '50px', + 'cell-xl': '64px', + header: '64px', + }, + maxHeight: { + 'cell-xs': '24px', + 'cell-sm': '32px', + 'cell-md': '40px', + 'cell-lg': '50px', + 'cell-xl': '64px', + }, + zIndex: { + backdrop: '20', + navigation: '30', + modal: '50', + dropdown: '60', + toast: '70', + 'main-section': '10', + 'tag-suggestions': '10', + 'drag-drop-input-overlay': '10', + 'configuration-drawer': '20', + 'selected-citation': '20', + 'read-only-conversation-footer': '30', + menu: '90', + 'guide-tooltip': '30', + tooltip: '50', + }, + boxShadow: { + drawer: '-10px 4px 12px -10px rgba(197, 188, 172, 0.48)', // secondary-400 + menu: '0px 4px 12px 0px rgba(197, 188, 172, 0.48)', // secondary-400 + top: '4px 0px 12px 0px rgba(197, 188, 172, 0.48)', // secondary-400 + }, + typography: (theme) => ({ + DEFAULT: { + css: { + color: theme('colors.volcanic.100'), + }, + }, + }), + keyframes: { + typing: { + '0%': { + width: '0%', + visibility: 'hidden', + }, + '100%': { + width: '100%', + }, + }, + 'left-to-right': { + '0%': { + left: '0%', + transform: 'translateX(-100%)', + }, + '100%': { + left: '100%', + transform: 'translateX(0%)', + }, + }, + borealisBar: { + '0%': { + left: '0%', + right: '100%', + width: '0%', + }, + '20%': { + left: '0%', + right: '75%', + width: '25%', + }, + '80%': { + right: '0%', + left: '75%', + width: '25%', + }, + '100%': { + left: '100%', + right: '0%', + width: '0%', + }, + }, + }, + animation: { + 'typing-ellipsis': 'typing 2s steps(4) infinite', + 'typing-loading-message': 'typing 0.7s steps(20)', + 'ping-once': 'ping 1s cubic-bezier(0, 0, 0.2, 1)', + 'left-to-right': 'left-to-right 0.5s ease-in-out infinite', + borealisBar: 'borealisBar 2s linear infinite', + }, + scale: { + 175: '1.75', + }, + variants: { + extend: {}, + }, + plugins: [], + }, + }, +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/tsconfig.json b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..5d0fc72fc8f68a0505972408eb34a3f6dad9f40a --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/coral_web/tsconfig.json @@ -0,0 +1,44 @@ +{ + "include": [ + "src", + "next-env.d.ts", + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + ".next/types/**/*.ts" + ], + "exclude": ["node_modules"], + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@/*": ["src/*"] + }, + "target": "es6", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "incremental": true, + "esModuleInterop": true, + "module": "esnext", + "resolveJsonModule": true, + "inlineSources": false, + "isolatedModules": true, + "composite": false, + "declaration": false, + "declarationMap": false, + "moduleResolution": "node", + "noUnusedLocals": false, + "noUnusedParameters": false, + "preserveWatchOutput": true, + "strictNullChecks": true, + "jsx": "preserve", + "skipLibCheck": true, + "plugins": [ + { + "name": "next" + } + ] + } +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/.env.example b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/.env.example new file mode 100644 index 0000000000000000000000000000000000000000..09b8952ce3fb49f5470faf99025c0f272c9635ad --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/.env.example @@ -0,0 +1,23 @@ +# Environment variables declared in this file are automatically made available to Prisma, and to the application when NODE_ENV=development. +# See README.md and https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema + +TOOLKIT_API_HOST=http://0.0.0.0:8000 +COHERE_ORGANIZATION_ID= +COHERE_SLACK_TEAM_ID= +SLACK_SIGNING_SECRET= +FEEDBACK_CLIENT_TAG= +COMMAND_SUFFIX= +SENTRY_DSN= +DATABASE_URL="postgresql://commandslack:password@localhost:5432/commandslackdb" + +# Option 1: socket mode +SLACK_CONNECTION_MODE=socket +SLACK_BOT_TOKEN= +SLACK_APP_TOKEN= + +# Option 2: http mode with OAuth +# SLACK_CONNECTION_MODE=http +# SLACK_CLIENT_ID= +# SLACK_CLIENT_SECRET= +# SLACK_STATE_SECRET=my-state-secret +# SLACK_INSTALL_PASSWORD=password \ No newline at end of file diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/.gitignore b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..5bc69f7a7e452b65480c0e2bf37916030a8b6b6e --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/.gitignore @@ -0,0 +1,4 @@ +.env +**/node_modules +**/coverage +.idea diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/.nvmrc b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/.nvmrc new file mode 100644 index 0000000000000000000000000000000000000000..3cce3cd4ca6d6d5aade6561c0595b26beed5da15 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/.nvmrc @@ -0,0 +1 @@ +v20.12.2 diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/.prettierignore b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/.prettierignore new file mode 100644 index 0000000000000000000000000000000000000000..ad85d6a6d86699c91fffeb8ca6e108a42188d8c3 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/.prettierignore @@ -0,0 +1,2 @@ +dist/ +coverage/ diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/.prettierrc.js b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/.prettierrc.js new file mode 100644 index 0000000000000000000000000000000000000000..c34e78f1c8b5c46bdcc87e112263a16eb3df8735 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/.prettierrc.js @@ -0,0 +1,10 @@ +// https://prettier.io/docs/en/options.html + +module.exports = { + printWidth: 100, + singleQuote: true, + importOrder: ['', '^@/*/(.*)$', '^[./]', '(.*)\\.css$'], + importOrderSeparation: true, + importOrderSortSpecifiers: true, + plugins: [require.resolve('@trivago/prettier-plugin-sort-imports')], +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/README.md b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f261db7a618869ab33cc897f9069d3cda04b31fa --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/README.md @@ -0,0 +1,370 @@ +# Command Slack Bot + +This is a Slack bot that uses the Cohere Toolkit to generate responses to messages. + +## Getting Started + +The Slack bot interface is a Node project that runs independently of the main Toolkit backend. The following steps are required to get up and running with the Slack bot: + +- Ensure that you have an instance of the Toolkit running and configured with required secrets +- Ensure that the Slack bot app is accessible from a public ip address +- Create a PostreSQL database and run the Prisma database migrations +- Create a new Slack app in your Slack account based on the example app manifest +- Configure environment variables and generate required values on the Slack website +- Add the Slack app to your workspace and complete OAuth flow +- Run the setup command in your Slack workspace +- Invite Command Slack Bot to a channel +- Optionally set channel parameters to override default model settings +- Begin chatting! + +The sections below will provide further details on these required steps. + +### Set up the Toolkit + +The Slack bot makes use of the Toolkit, and requires the Toolkit to be running separately +from the Slack bot. All requests to the models are made through requests to the Toolkit APIs. + +Please see the documentation for the Toolkit to see how configure and deploy it. + +https://github.com/cohere-ai/cohere-toolkit + +If you are running the Toolkit on localhost, the default API URL should work. If you have +the Toolkit deployed on a server, then you will need to set the `TOOLKIT_API_HOST` environment +variable with the appropriate value. + +### Deploy app or configure ngrok for local dev + +There are two ways for the Slack bot to receive data from Slack. The recommended way is to use +webhooks, which requires Slack to be able to make HTTP requests to the running Slack bot app from +this repo. For Slack to make those requests, it requires the app to be accessible on a public IP address. +The URLs for the webhooks must be configured in the app manifest on the Slack website. + +If the app is deployed to a server, this should be no problem. Use the hostname of the server where +you have deployed it. For local development, however, Slack needs to be able to access the webhook +endpoints running in your local environment, which requires a proxy for local development. + +One way of doing this is with a program called ngrok. It is a service that allows you to access code +running on your local machine from a public ip and domain. It is a commercial app, but there is +a free tier that should be sufficient for local development of this app. + +Please see https://ngrok.com for instructions on installing ngrok and obtaining an API key. + +Once ngrok is set up, you can start it with: + +`ngrok http 3000` + +On the free plan this will give you a random domain each time. There is a `-domain` option that will +allow you to choose a specific hostname if it is available. Paid accounts can reserve specific +hostnames for your use only, which could be useful for ongoing development, since the hostname needs +to be saved in several different places in the app manifest, and not using a reserved domain could +require you to have to make changes to the app configuration on the Slack website, each time the +ngrok domain you are assigned changes. + +Alternatively, the Slack bot can be used with socket mode. With socket mode, the bot will +establish a websocket connection to Slack, over which the Slack events can be received. Socket +mode can simplify local development by eliminating the requirement for a proxy to your local environment. + +Use of socket mode requires socket mode to be enabled in the Slack app configuration on the Slack +website, in addition to being enabled and configured with socket mode specific secrets in the +environment variables. See the section further below for more information on configuring socket mode. + +### Create PostgreSQL database and run migrations + +The Slack bot requires a PostgreSQL database for storing workspace and channel settings. Follow standard +procedures for creating a PostgreSQL database and once the database and PostgreSQL user have been +created, set the `DATABASE_URL` environment variable. + +You can use any database name, user and host as long as the `DATABASE_URL` is configured. The following +steps are a guide for how to do this. + +Start the psql shell with a postgres admin account. + +```shell +psql --host=localhost --port=5432 --username=postgres +``` + +In the psql shell run the following commands: + +``` +CREATE DATABASE commandslackdb; +CREATE USER commandslack WITH PASSWORD 'password'; +GRANT ALL PRIVILEGES ON DATABASE commandslackdb TO commandslack; +ALTER USER commandslack WITH CREATEDB; +``` + +Set the `DATABASE_URL` with the db name, user and password you used above: + +```shell +DATABASE_URL="postgresql://commandslack:password@localhost:5432/commandslackdb"` +``` + +Once the database has been set up, you must run the Prisma migrations. In development use: + +```shell +prisma migrate dev +``` + +### Create Slack app + +To use the Slack bot, you must create your own app on the api.slack.com website. Choose the option +to create a new app, and choose the option "From an app manifest". Follow the instructions to +choose the workspace, and when prompted for the manifest, choose the YAML option, and copy and paste +the contents of the `example-manifest.yaml` file from this repo. + +It is possible to custom configure all the values in Slack, and it is not mandatory to use the +all the settings from the example manifest. For example, you could change the display name +or username of the bot. However, using the `example-manifest.yaml` file will make the process much +simpler. For getting up and running quickly, it is strongly recommended to start with this file, +rather than custom configuring all required values from scratch. There are some important defaults +in the example that could lead to hard to debug problems if they are not present. + +When configuring the Slack app, it is important to change the hostnames of all URLs in the example +manifest. Every instance of https://slack-bot-host/slack/events in the example manifest must be +changed to use the domain of your deployed app or the ngrok domain you are using for local development. + +### Configure environment variables + +For local development, copy the `.env.example` file to `.env`, and edit the values accordingly. The +required values depend on whether you choose to use HTTP mode (recommended for production) or socket mode. + +### Add the Slack app to your workspace and complete OAuth flow + +The Command Slack bot may appear in your workspace after you create the new app from the manifest, but +it will not work properly without granting permissions with OAuth. + +In order for the OAuth flow to work, you must ensure that the Slack app has the redirect URL configured +in the Slack app configuration/manifest. The default redirect URL in the example is set to +https://slack-bot-host/slack/oauth_redirect, but the host name needs to be changed. Ensure this was +done in the previous steps. + +To grant OAuth permissions, go to the following URL: + +https://slack-bot-host/slack/install/ + +You can optionally set an environment variable called `SLACK_INSTALL_PASSWORD` to obscure this URL. +If you set the value, the URL to start OAuth flow will be: + +https://slack-bot-host/slack/install/password-you-chose + +You must of course change the host to the server where the Slack bot is deployed or the proxy address. + +This page will redirect you to Slack, and after you grant the permissions, you will be redirected +back to the Slack bot host in your browser. When returning, you should come back to the following +URL: + +https://slack-bot-host/slack/oauth_redirect + +The above URL does not change based on the value of `SLACK_INSTALL_PASSWORD` like the install +URL does. + +When you return, you will be prompted to open the Slack application by your browser. You should allow this. + +### Run the setup command in your Slack workspace + +The Command Slack bot will add several new `/` commands to your Slack workspace. To begin using the +bot, you must run the `/setup-command` command inside of Slack. If this command is not available in +your workspace, it means that the above steps have not been completed successfully yet. + +When the Slack bot is running in production environments, only an administrator of the Slack workspace +can run the `/setup-command` command. When `NODE_ENV` is set to `development`, this restricted is lifted, +and anyone can run `/setup-command`. Some features of the Slack bot may work before this has been run, +but it is advisable to run it as soon as you've completed the OAuth flow, in order to avoid any hard +to debug problems when there is no record in the `WorkspaceSettings` table. + +### Invite Command Slack Bot to a channel + +If you have followed the above instructions, with the suggested defaults, then you should now have the +Command Slack bot in your workspace. The default username in the example manifest is `@Command`. You +should be able to talk to this user directly, or invite `@Command` to a channel. In order for it to +respond in a channel, you must tag the user `@Command`. Once `@Command` has been tagged in a thread, +it will continue responding to that thread without being tagged. + +### Optionally set channel parameters to override default model settings + +To see the full list of commands available, type `/command-help` in your workspace in the Slack application. + +The configuration commands available include: + +- `/set-deployment [deployment name]` - Set the deployment used for a specific channel +- `/view-deployment` - View the deployment used for a specific channel +- `/set-model [model name]` - Set the model used for a specific channel +- `/view-model` - View the model used for a specific channel +- `/set-temperature [0.0 - 5.0]` - Set the temperature used for a specific channel +- `/view-temperature` - View the temperature used for a specific channel +- `/set-preamble [preamble]` - Set the preamble override used for a specific channel +- `/view-preamble` - View the preamble override used for a specific channel +- `/set-tools` - Set tools for a specific channel +- `/view-tools [all]` - View all tools available in your Cohere account or tools enabled for a specific channel + +### Begin chatting! + +You should now be able to use the Command Slack bot in your workspace. You can communicate with `@Command` via +direct message, or tagging `@Command` in channel messages. There are also several other commands available, +to perform actions such as summarize a thread. To see the full list of things `@Command` can do, run the +`/command-help` command. + +## Usage + +The Command Slack bot is a Node application built with TypeScript. + +```shell +# start in development mode +pnpm dev + +# build for production +pnpm build + +# run sql migrations and start in production mode +pnpm start + +# lint +pnpm lint + +# check formatting with prettier +pnpm format + +# format with prettier +pnpm format:write + +# run all unit tests, with coverage report +pnpm test + +# run and watch unit tests +pnpm test:watch +``` + +## Project Structure + +```text +slack_bot/ +├─ src/ +│ ├─ constants.ts +│ │ ∟ constants live here +│ ├─ cohere-client/ +│ │ ∟ functions that interact with the toolkit api live here +│ ├─ handlers/ +│ │ ∟ functions that handle slack events live here +│ ├─ utils/ +│ │ ∟ miscellaneous utility functions live here +``` + +## Socket Mode and HTTP Mode + +The Slack bot supports two modes of operation: Socket Mode and HTTP Mode. + +In Socket Mode, the application initiates a connection to Slack via a long-lived TCP connection. This mode is recommended for local development and for private cloud deployment, since it requires no public HTTP endpoints to be exposed. + +In HTTP Mode, the application exposes HTTP endpoints that Slack can use to send events and commands. This mode is recommended for public cloud deployment, since it supports installation via the public [Slack App Directory](https://api.slack.com/start/distributing#app_directory_apps). + +The `SLACK_CONNECTION_MODE` environment variable controls which mode is used. Additional environment variables are required for each mode, as described under [Environment variables](#environment-variables). + +Socket mode must also enabled in the Slack app configuration, under "Socket Mode" in the Settings menu. + +The event subscription request URL will be https://slack-bot-host/slack/events, where "slack-bot-host" should be replaced with the hostname where the command slack bot is deployed. + +See also: + +- https://api.slack.com/apis/connections/socket +- https://slack.dev/bolt-js/concepts#socket-mode + +## Database migrations + +Apply migrations in development: + +``` +./node_modules/.bin/prisma migrate dev +``` + +Create new migration: + +``` +./node_modules/.bin/prisma migrate dev --name +``` + +Apply migrations in production: + +``` +./node_modules/.bin/prisma migrate deploy +``` + +_Note: `prisma migrate deploy` is run automatically upon `pnpm start` in production._ + +See also: + +- https://www.prisma.io/docs/concepts/components/prisma-migrate/migrate-development-production + +## Slack App Configuration + +To use the bot with Slack, you'll need to create a new Slack App and install it to your workspace. The easiest way to do this is to use +the option to create a new app **from an app manifest**. Use the `example-manifest.yaml` file in this repo and tweak as needed. Ensure +that you change the toolkit host in the URLs to the URL where the Slack bot is being hosted. + +To create a new Slack app, visit: + +https://api.slack.com/apps?new_app=1 + +Alternatively, you can create a new Slack app from scratch. You can do this by following the instructions in the [Slack Bolt documentation](https://slack.dev/bolt-js/tutorial/getting-started), including the "Tokens and installing apps" step and "Setting up events" step. + +As a result of this process, you should have a signing secret, bot token, and app-level token, which you must set as environment variables. + +There are several differences in the Slack app configuration based on whether you use socket mode or HTTP mode. + +### Socket Mode + +You must enable socket mode in the Slack app configuration. + +See: https://slack.dev/bolt-js/tutorial/getting-started#setting-up-events. + +### HTTP Mode + +With HTTP mode, you must ensure that event subscriptions are enabled on the _Event Subscriptions_ page under the _Features_ menu. You must also ensure that the URL to the Command Slack bot's events hook has been entered into the _Request URL_ field. The URL to handle events should be https://slack-bot-host/slack/events. + +With HTTP mode it is also necessary to grant OAuth permissions. + +### Testing with HTTP Mode + +To test with HTTP Mode, you'll need to expose the bot to the public internet. You can do this with [ngrok](https://ngrok.com/): + +```shell +brew install ngrok +ngrok http 3000 +``` + +This command will expose a public HTTPS server which you can use to receive Slack events, e.g. https://6c36-142-181-59-160.ngrok-free.app. Use this URL in your App's config on https://api.slack.com/apps. + +You can install the Slack App to a workspace by appending `/slack/install`, e.g. https://6c36-142-181-59-160.ngrok-free.app/slack/install. + +For some ngrok features, you will need to sign up with a free account: https://ngrok.com/signup. + +## Environment variables + +| Variable | Required for Socket Mode | Required for HTTP Mode | Example | Description | +| ------------------------ | ------------------------ | ---------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `TOOLKIT_API_HOST` | Yes | Yes | `http://0.0.0.0:8000` | Protocol and host to access the Cohere Toolkit API. | +| `COHERE_SLACK_TEAM_ID` | Yes | Yes | `TV82C32HX` | Cohere's Slack Workspace Team ID. Can include multiple comma separated IDs | +| `COHERE_ORGANIZATION_ID` | Yes | Yes | `d489c39a-e152-49da-9ddc-9801bd74d823` | Cohere's Org ID | +| `SLACK_CONNECTION_MODE` | Yes | Yes | `socket` or `http` | Whether to use Socket Mode or HTTP Mode. | +| `SLACK_SIGNING_SECRET` | Yes | Yes | `abc123` | Signing secret from _Basic Information -> App Credentials -> Signing Secret_. | +| `SLACK_BOT_TOKEN` | Yes | No | `xoxb-abc123` | OAuth token from _OAuth & Permissions -> Bot User OAuth Token_. | +| `SLACK_APP_TOKEN` | Yes | No | `xapp-abc123` | App-Level token from _Basic Information -> App-Level Tokens_. Must contain the `connections:write` scope. | +| `DATABASE_URL` | No | Yes | `postgresql://commandslack:password@localhost:5432/commandslackdb` | Prisma-compatible PostgreSQL database URL. | +| `SLACK_CLIENT_ID` | No | Yes | `abc.123` | OAuth client ID from _Basic Information -> App Credentials -> Client ID_. | +| `SLACK_CLIENT_SECRET` | No | Yes | `abc123` | OAuth client secret from _Basic Information -> App Credentials -> Client Secret_. | +| `SLACK_STATE_SECRET` | No | Yes | `my-state-secret` | Sufficiently random static string used to secure the OAuth flow in web browsers. This can be changed when redeploying the app. | +| `SLACK_INSTALL_PASSWORD` | No | Yes | `mypassword` | A value to make the installation URL hard to guess. The URL will be `${HOST}/slack/install/${SLACK_INSTALL_PASSWORD}`. | +| `COMMAND_SUFFIX` | Yes | Yes | `-stg` | Suffix to add to command names to avoid collisions | +| `SENTRY_DSN` | No | No | `https://{SENTRY-ACCOUNT}.ingest.sentry.io/{SENTRY-ID}` | Optional value to send error events to the right Sentry project | + +In development with `pnpm dev`, the bot will automatically load environment variables from a `.env` file in the root of the project. You can copy the `.env.example` file to get started: + +```shell +cp .env.example .env +# edit .env with values from your Slack App +``` + +## Resources + +- https://slack.dev/bolt-js/tutorial/getting-started +- https://slack.dev/bolt-js/reference +- https://github.com/vercel/turbo/tree/main/examples/kitchen-sink/apps/api +- https://github.com/slackapi/bolt-js/tree/main/examples/getting-started-typescript diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/eslint.config.js b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/eslint.config.js new file mode 100644 index 0000000000000000000000000000000000000000..809cb30b422a5863d6ffb47f79cc3c2eb309111d --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/eslint.config.js @@ -0,0 +1,8 @@ +const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended'); + +module.exports = [ + { + ignores: ['coverage'], + }, + eslintPluginPrettierRecommended, +]; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/example-manifest.yaml b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/example-manifest.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6c03ea4f8f8adbeba3e3cec3208d02d871df3e32 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/example-manifest.yaml @@ -0,0 +1,110 @@ +display_information: + name: Command Slack Bot + description: Slack bot to chat with LLMs using Cohere Toolkit + background_color: '#2c2d30' + long_description: Use this slack bot to chat with LLMs using the Cohere Toolkit backend. It supports RAG, changing model parameters, and the use of tools. +features: + bot_user: + display_name: Command + always_online: true + shortcuts: + - name: Summarize thread + type: message + callback_id: summarize_thread + description: Summarize the current thread + slash_commands: + - command: /summarize + url: https://slack-bot-host/slack/events + description: Post a summary of a slack thread given a link + usage_hint: '[thread link]' + should_escape: false + - command: /command-help + url: https://slack-bot-host/slack/events + description: What can Command do? + should_escape: false + - command: /set-model + url: https://slack-bot-host/slack/events + description: Set the channel model + usage_hint: '[model-name]' + should_escape: false + - command: /set-deployment + url: https://slack-bot-host/slack/events + description: Set the channel model deployment + usage_hint: '[deployment-name]' + should_escape: false + - command: /view-deployment + url: https://slack-bot-host/slack/events + description: View the channel model deployment + usage_hint: '[deployment-name]' + should_escape: false + - command: /view-model + url: https://slack-bot-host/slack/events + description: View the current channel model + should_escape: false + - command: /set-temperature + url: https://slack-bot-host/slack/events + description: Sets the temperature for the channel + usage_hint: '[0.0 - 5.0]' + should_escape: false + - command: /view-temperature + url: https://slack-bot-host/slack/events + description: View the temperature for the channel + should_escape: false + - command: /set-preamble + url: https://slack-bot-host/slack/events + description: Sets the preamble for the channel + usage_hint: '[preamble]' + should_escape: false + - command: /view-preamble + url: https://slack-bot-host/slack/events + description: View the preamble for the channel + should_escape: false + - command: /setup-command + url: https://slack-bot-host/slack/events + description: Setup Command for the workspace + should_escape: false + - command: /view-tools + url: https://slack-bot-host/slack/events + description: View tools active in the current channel or list all tools available in your workspace + usage_hint: '[all]' + should_escape: false + - command: /set-tools + url: https://slack-bot-host/slack/events + description: Configure the tools for the channel + should_escape: false +oauth_config: + redirect_urls: + - https://slack-bot-host/slack/oauth_redirect + scopes: + bot: + - app_mentions:read + - channels:history + - channels:read + - chat:write + - commands + - groups:history + - im:history + - im:read + - im:write + - mpim:history + - mpim:read + - mpim:write + - reactions:read + - users:read + - groups:read + - reactions:write + - files:read +settings: + event_subscriptions: + bot_events: + - app_mention + - message.channels + - message.groups + - message.im + - message.mpim + - reaction_added + interactivity: + is_enabled: true + org_deploy_enabled: false + socket_mode_enabled: true + token_rotation_enabled: false diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/package-lock.json b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..ca52e58fd90e09e4a5bbd45fc7511d1be27e3180 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/package-lock.json @@ -0,0 +1,8275 @@ +{ + "name": "@cohere-ai/command-slack-bot", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@cohere-ai/command-slack-bot", + "version": "0.0.0", + "dependencies": { + "@microsoft/fetch-event-source": "^2.0.1", + "@prisma/client": "^5.20.0", + "@sentry/node": "^7.64.0", + "@slack/bolt": "^3.18.0", + "@slack/web-api": "^6.12.0", + "@types/node": "20.12.11", + "@types/offscreencanvas": "^2019.7.3", + "@types/word-extractor": "^1.0.2", + "@vitest/ui": "^1.6.1", + "axios": "^1.7.4", + "dotenv": "^16.0.3", + "eslint": "^9.3.0", + "form-data": "^4.0.0", + "npm-run-all": "^4.1.5", + "openapi-typescript-codegen": "^0.29.0", + "pdfjs-dist": "4.2.67", + "prettier": "^3.2.5", + "prisma": "^5.14.0", + "slackify-markdown": "^4.4.0", + "tsup": "^8.0.0", + "typescript": "^5.4.5", + "vite": "^5.4.14", + "vite-tsconfig-paths": "^4.3.2", + "vitest": "^1.6.1", + "word-extractor": "^1.0.4" + }, + "devDependencies": { + "@trivago/prettier-plugin-sort-imports": "^4.3.0", + "@vitest/coverage-v8": "^1.6.1", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.1.3" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@apidevtools/json-schema-ref-parser": { + "version": "11.6.4", + "resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-11.6.4.tgz", + "integrity": "sha512-9K6xOqeevacvweLGik6LnZCb1fBtCOSIWQs8d096XGeqoLKC33UVMGz9+77Gw44KvbH4pKcQPWo4ZpxkXYj05w==", + "dependencies": { + "@jsdevtools/ono": "^7.1.3", + "@types/json-schema": "^7.0.15", + "js-yaml": "^4.1.0" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/philsturgeon" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", + "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.24.7", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/generator": { + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.7.tgz", + "integrity": "sha512-oLcVCTeIFadUoArDTwpluncplrYBmTCCZZgXCbgNGvOBBiSDDK3eWO4b/+eOTli5tKv1lg+a5/NAXg+nTcei1w==", + "dev": true, + "dependencies": { + "@babel/types": "^7.17.0", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-environment-visitor": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.24.7.tgz", + "integrity": "sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ==", + "dev": true, + "dependencies": { + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-environment-visitor/node_modules/@babel/types": { + "version": "7.24.9", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.9.tgz", + "integrity": "sha512-xm8XrMKz0IlUdocVbYJe0Z9xEgidU7msskG8BbhnTPK/HZ2z/7FP7ykqPgrUH+C+r414mNfNWam1f2vqOjqjYQ==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.8", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-function-name": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.24.7.tgz", + "integrity": "sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA==", + "dev": true, + "dependencies": { + "@babel/template": "^7.24.7", + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-function-name/node_modules/@babel/types": { + "version": "7.24.9", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.9.tgz", + "integrity": "sha512-xm8XrMKz0IlUdocVbYJe0Z9xEgidU7msskG8BbhnTPK/HZ2z/7FP7ykqPgrUH+C+r414mNfNWam1f2vqOjqjYQ==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.8", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-hoist-variables": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.24.7.tgz", + "integrity": "sha512-MJJwhkoGy5c4ehfoRyrJ/owKeMl19U54h27YYftT0o2teQ3FJ3nQUf/I3LlJsX4l3qlw7WRXUmiyajvHXoTubQ==", + "dev": true, + "dependencies": { + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-hoist-variables/node_modules/@babel/types": { + "version": "7.24.9", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.9.tgz", + "integrity": "sha512-xm8XrMKz0IlUdocVbYJe0Z9xEgidU7msskG8BbhnTPK/HZ2z/7FP7ykqPgrUH+C+r414mNfNWam1f2vqOjqjYQ==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.8", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-split-export-declaration": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.7.tgz", + "integrity": "sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-split-export-declaration/node_modules/@babel/types": { + "version": "7.24.9", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.9.tgz", + "integrity": "sha512-xm8XrMKz0IlUdocVbYJe0Z9xEgidU7msskG8BbhnTPK/HZ2z/7FP7ykqPgrUH+C+r414mNfNWam1f2vqOjqjYQ==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.8", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz", + "integrity": "sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", + "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", + "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.24.7", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.8.tgz", + "integrity": "sha512-WzfbgXOkGzZiXXCqk43kKwZjzwx4oulxZi3nq2TYL9mOjQv6kYwul9mz6ID36njuL7Xkp6nJEfok848Zj10j/w==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/template": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.7.tgz", + "integrity": "sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.24.7", + "@babel/parser": "^7.24.7", + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template/node_modules/@babel/types": { + "version": "7.24.9", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.9.tgz", + "integrity": "sha512-xm8XrMKz0IlUdocVbYJe0Z9xEgidU7msskG8BbhnTPK/HZ2z/7FP7ykqPgrUH+C+r414mNfNWam1f2vqOjqjYQ==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.8", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz", + "integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.23.0", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.23.0", + "@babel/types": "^7.23.0", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/@babel/generator": { + "version": "7.24.9", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.9.tgz", + "integrity": "sha512-G8v3jRg+z8IwY1jHFxvCNhOPYPterE4XljNgdGTYfSTtzzwjIswIzIaSPSLs3R7yFuqnqNeay5rjICfqVr+/6A==", + "dev": true, + "dependencies": { + "@babel/types": "^7.24.9", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/@babel/types": { + "version": "7.24.9", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.9.tgz", + "integrity": "sha512-xm8XrMKz0IlUdocVbYJe0Z9xEgidU7msskG8BbhnTPK/HZ2z/7FP7ykqPgrUH+C+r414mNfNWam1f2vqOjqjYQ==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.8", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.17.0.tgz", + "integrity": "sha512-TmKSNO4D5rzhL5bjWFcVHHLETzfQ/AmbKpKPOSjlP0WoHZ6L911fgoOKY4Alp/emzG4cHJdyN49zpgkbXFEHHw==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.16.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.0.tgz", + "integrity": "sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.17.0.tgz", + "integrity": "sha512-A68TBu6/1mHHuc5YJL0U0VVeGNiklLAL6rRmhTCP2B5XjWLMnrX+HkO+IAXyHvks5cyyY1jjK5ITPQ1HGS2EVA==", + "dependencies": { + "@eslint/object-schema": "^2.1.4", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", + "integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/js": { + "version": "9.7.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.7.0.tgz", + "integrity": "sha512-ChuWDQenef8OSFnvuxv0TCVxEwmu3+hPNKvM9B34qpM0rDRbjL8t5QkQeHHeAfsKQjuH9wS82WeCi1J/owatng==", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz", + "integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.0.tgz", + "integrity": "sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "license": "MIT", + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@jsdevtools/ono": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", + "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==" + }, + "node_modules/@mapbox/node-pre-gyp": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz", + "integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==", + "optional": true, + "dependencies": { + "detect-libc": "^2.0.0", + "https-proxy-agent": "^5.0.0", + "make-dir": "^3.1.0", + "node-fetch": "^2.6.7", + "nopt": "^5.0.0", + "npmlog": "^5.0.1", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "tar": "^6.1.11" + }, + "bin": { + "node-pre-gyp": "bin/node-pre-gyp" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "optional": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/make-dir/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "optional": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@microsoft/fetch-event-source": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@microsoft/fetch-event-source/-/fetch-event-source-2.0.1.tgz", + "integrity": "sha512-W6CLUJ2eBMw3Rec70qrsEW0jOm/3twwJv21mrmj2yORiaVmVYGS4sSS5yUwvQc1ZlDLYGPnClVWmUUMagKNsfA==" + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@pkgr/core": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", + "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/@polka/url": { + "version": "1.0.0-next.28", + "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.28.tgz", + "integrity": "sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==", + "license": "MIT" + }, + "node_modules/@prisma/client": { + "version": "5.20.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.20.0.tgz", + "integrity": "sha512-CLv55ZuMuUawMsxoqxGtLT3bEZoa2W8L3Qnp6rDIFWy+ZBrUcOFKdoeGPSnbBqxc3SkdxJrF+D1veN/WNynZYA==", + "hasInstallScript": true, + "engines": { + "node": ">=16.13" + }, + "peerDependencies": { + "prisma": "*" + }, + "peerDependenciesMeta": { + "prisma": { + "optional": true + } + } + }, + "node_modules/@prisma/debug": { + "version": "5.20.0", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.20.0.tgz", + "integrity": "sha512-oCx79MJ4HSujokA8S1g0xgZUGybD4SyIOydoHMngFYiwEwYDQ5tBQkK5XoEHuwOYDKUOKRn/J0MEymckc4IgsQ==" + }, + "node_modules/@prisma/engines": { + "version": "5.20.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.20.0.tgz", + "integrity": "sha512-DtqkP+hcZvPEbj8t8dK5df2b7d3B8GNauKqaddRRqQBBlgkbdhJkxhoJTrOowlS3vaRt2iMCkU0+CSNn0KhqAQ==", + "hasInstallScript": true, + "dependencies": { + "@prisma/debug": "5.20.0", + "@prisma/engines-version": "5.20.0-12.06fc58a368dc7be9fbbbe894adf8d445d208c284", + "@prisma/fetch-engine": "5.20.0", + "@prisma/get-platform": "5.20.0" + } + }, + "node_modules/@prisma/engines-version": { + "version": "5.20.0-12.06fc58a368dc7be9fbbbe894adf8d445d208c284", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.20.0-12.06fc58a368dc7be9fbbbe894adf8d445d208c284.tgz", + "integrity": "sha512-Lg8AS5lpi0auZe2Mn4gjuCg081UZf88k3cn0RCwHgR+6cyHHpttPZBElJTHf83ZGsRNAmVCZCfUGA57WB4u4JA==" + }, + "node_modules/@prisma/fetch-engine": { + "version": "5.20.0", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.20.0.tgz", + "integrity": "sha512-JVcaPXC940wOGpCOwuqQRTz6I9SaBK0c1BAyC1pcz9xBi+dzFgUu3G/p9GV1FhFs9OKpfSpIhQfUJE9y00zhqw==", + "dependencies": { + "@prisma/debug": "5.20.0", + "@prisma/engines-version": "5.20.0-12.06fc58a368dc7be9fbbbe894adf8d445d208c284", + "@prisma/get-platform": "5.20.0" + } + }, + "node_modules/@prisma/get-platform": { + "version": "5.20.0", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.20.0.tgz", + "integrity": "sha512-8/+CehTZZNzJlvuryRgc77hZCWrUDYd/PmlZ7p2yNXtmf2Una4BWnTbak3us6WVdqoz5wmptk6IhsXdG2v5fmA==", + "dependencies": { + "@prisma/debug": "5.20.0" + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.4.tgz", + "integrity": "sha512-Fxamp4aEZnfPOcGA8KSNEohV8hX7zVHOemC8jVBoBUHu5zpJK/Eu3uJwt6BMgy9fkvzxDaurgj96F/NiLukF2w==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.4.tgz", + "integrity": "sha512-VXoK5UMrgECLYaMuGuVTOx5kcuap1Jm8g/M83RnCHBKOqvPPmROFJGQaZhGccnsFtfXQ3XYa4/jMCJvZnbJBdA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.4.tgz", + "integrity": "sha512-xMM9ORBqu81jyMKCDP+SZDhnX2QEVQzTcC6G18KlTQEzWK8r/oNZtKuZaCcHhnsa6fEeOBionoyl5JsAbE/36Q==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.4.tgz", + "integrity": "sha512-aJJyYKQwbHuhTUrjWjxEvGnNNBCnmpHDvrb8JFDbeSH3m2XdHcxDd3jthAzvmoI8w/kSjd2y0udT+4okADsZIw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.4.tgz", + "integrity": "sha512-j63YtCIRAzbO+gC2L9dWXRh5BFetsv0j0va0Wi9epXDgU/XUi5dJKo4USTttVyK7fGw2nPWK0PbAvyliz50SCQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.4.tgz", + "integrity": "sha512-dJnWUgwWBX1YBRsuKKMOlXCzh2Wu1mlHzv20TpqEsfdZLb3WoJW2kIEsGwLkroYf24IrPAvOT/ZQ2OYMV6vlrg==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.4.tgz", + "integrity": "sha512-AdPRoNi3NKVLolCN/Sp4F4N1d98c4SBnHMKoLuiG6RXgoZ4sllseuGioszumnPGmPM2O7qaAX/IJdeDU8f26Aw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.4.tgz", + "integrity": "sha512-Gl0AxBtDg8uoAn5CCqQDMqAx22Wx22pjDOjBdmG0VIWX3qUBHzYmOKh8KXHL4UpogfJ14G4wk16EQogF+v8hmA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.4.tgz", + "integrity": "sha512-3aVCK9xfWW1oGQpTsYJJPF6bfpWfhbRnhdlyhak2ZiyFLDaayz0EP5j9V1RVLAAxlmWKTDfS9wyRyY3hvhPoOg==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.4.tgz", + "integrity": "sha512-ePYIir6VYnhgv2C5Xe9u+ico4t8sZWXschR6fMgoPUK31yQu7hTEJb7bCqivHECwIClJfKgE7zYsh1qTP3WHUA==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.4.tgz", + "integrity": "sha512-GqFJ9wLlbB9daxhVlrTe61vJtEY99/xB3C8e4ULVsVfflcpmR6c8UZXjtkMA6FhNONhj2eA5Tk9uAVw5orEs4Q==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.4.tgz", + "integrity": "sha512-87v0ol2sH9GE3cLQLNEy0K/R0pz1nvg76o8M5nhMR0+Q+BBGLnb35P0fVz4CQxHYXaAOhE8HhlkaZfsdUOlHwg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.4.tgz", + "integrity": "sha512-UV6FZMUgePDZrFjrNGIWzDo/vABebuXBhJEqrHxrGiU6HikPy0Z3LfdtciIttEUQfuDdCn8fqh7wiFJjCNwO+g==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.4.tgz", + "integrity": "sha512-BjI+NVVEGAXjGWYHz/vv0pBqfGoUH0IGZ0cICTn7kB9PyjrATSkX+8WkguNjWoj2qSr1im/+tTGRaY+4/PdcQw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.4.tgz", + "integrity": "sha512-SiWG/1TuUdPvYmzmYnmd3IEifzR61Tragkbx9D3+R8mzQqDBz8v+BvZNDlkiTtI9T15KYZhP0ehn3Dld4n9J5g==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.4.tgz", + "integrity": "sha512-j8pPKp53/lq9lMXN57S8cFz0MynJk8OWNuUnXct/9KCpKU7DgU3bYMJhwWmcqC0UU29p8Lr0/7KEVcaM6bf47Q==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@sentry-internal/tracing": { + "version": "7.118.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.118.0.tgz", + "integrity": "sha512-dERAshKlQLrBscHSarhHyUeGsu652bDTUN1FK0m4e3X48M3I5/s+0N880Qjpe5MprNLcINlaIgdQ9jkisvxjfw==", + "dependencies": { + "@sentry/core": "7.118.0", + "@sentry/types": "7.118.0", + "@sentry/utils": "7.118.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/core": { + "version": "7.118.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.118.0.tgz", + "integrity": "sha512-ol0xBdp3/K11IMAYSQE0FMxBOOH9hMsb/rjxXWe0hfM5c72CqYWL3ol7voPci0GELJ5CZG+9ImEU1V9r6gK64g==", + "dependencies": { + "@sentry/types": "7.118.0", + "@sentry/utils": "7.118.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/integrations": { + "version": "7.118.0", + "resolved": "https://registry.npmjs.org/@sentry/integrations/-/integrations-7.118.0.tgz", + "integrity": "sha512-C2rR4NvIMjokF8jP5qzSf1o2zxDx7IeYnr8u15Kb2+HdZtX559owALR0hfgwnfeElqMhGlJBaKUWZ48lXJMzCQ==", + "dependencies": { + "@sentry/core": "7.118.0", + "@sentry/types": "7.118.0", + "@sentry/utils": "7.118.0", + "localforage": "^1.8.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/node": { + "version": "7.118.0", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.118.0.tgz", + "integrity": "sha512-79N63DvYKkNPqzmc0cjO+vMZ/nU7+CbE3K3COQNiV7gk58+666G9mRZQJuZVOVebatq5wM5UR0G4LPkwD+J84g==", + "dependencies": { + "@sentry-internal/tracing": "7.118.0", + "@sentry/core": "7.118.0", + "@sentry/integrations": "7.118.0", + "@sentry/types": "7.118.0", + "@sentry/utils": "7.118.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/types": { + "version": "7.118.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.118.0.tgz", + "integrity": "sha512-2drqrD2+6kgeg+W/ycmiti3G4lJrV3hGjY9PpJ3bJeXrh6T2+LxKPzlgSEnKFaeQWkXdZ4eaUbtTXVebMjb5JA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/utils": { + "version": "7.118.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.118.0.tgz", + "integrity": "sha512-43qItc/ydxZV1Zb3Kn2M54RwL9XXFa3IAYBO8S82Qvq5YUYmU2AmJ1jgg7DabXlVSWgMA1HntwqnOV3JLaEnTQ==", + "dependencies": { + "@sentry/types": "7.118.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "license": "MIT" + }, + "node_modules/@slack/bolt": { + "version": "3.22.0", + "resolved": "https://registry.npmjs.org/@slack/bolt/-/bolt-3.22.0.tgz", + "integrity": "sha512-iKDqGPEJDnrVwxSVlFW6OKTkijd7s4qLBeSufoBsTM0reTyfdp/5izIQVkxNfzjHi3o6qjdYbRXkYad5HBsBog==", + "dependencies": { + "@slack/logger": "^4.0.0", + "@slack/oauth": "^2.6.3", + "@slack/socket-mode": "^1.3.6", + "@slack/types": "^2.13.0", + "@slack/web-api": "^6.13.0", + "@types/express": "^4.16.1", + "@types/promise.allsettled": "^1.0.3", + "@types/tsscmp": "^1.0.0", + "axios": "^1.7.4", + "express": "^4.21.0", + "path-to-regexp": "^8.1.0", + "promise.allsettled": "^1.0.2", + "raw-body": "^2.3.3", + "tsscmp": "^1.0.6" + }, + "engines": { + "node": ">=14.21.3", + "npm": ">=6.14.18" + } + }, + "node_modules/@slack/logger": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@slack/logger/-/logger-4.0.0.tgz", + "integrity": "sha512-Wz7QYfPAlG/DR+DfABddUZeNgoeY7d1J39OCR2jR+v7VBsB8ezulDK5szTnDDPDwLH5IWhLvXIHlCFZV7MSKgA==", + "dependencies": { + "@types/node": ">=18.0.0" + }, + "engines": { + "node": ">= 18", + "npm": ">= 8.6.0" + } + }, + "node_modules/@slack/oauth": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/@slack/oauth/-/oauth-2.6.3.tgz", + "integrity": "sha512-1amXs6xRkJpoH6zSgjVPgGEJXCibKNff9WNDijcejIuVy1HFAl1adh7lehaGNiHhTWfQkfKxBiF+BGn56kvoFw==", + "dependencies": { + "@slack/logger": "^3.0.0", + "@slack/web-api": "^6.12.1", + "@types/jsonwebtoken": "^8.3.7", + "@types/node": ">=12", + "jsonwebtoken": "^9.0.0", + "lodash.isstring": "^4.0.1" + }, + "engines": { + "node": ">=12.13.0", + "npm": ">=6.12.0" + } + }, + "node_modules/@slack/oauth/node_modules/@slack/logger": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@slack/logger/-/logger-3.0.0.tgz", + "integrity": "sha512-DTuBFbqu4gGfajREEMrkq5jBhcnskinhr4+AnfJEk48zhVeEv3XnUKGIX98B74kxhYsIMfApGGySTn7V3b5yBA==", + "dependencies": { + "@types/node": ">=12.0.0" + }, + "engines": { + "node": ">= 12.13.0", + "npm": ">= 6.12.0" + } + }, + "node_modules/@slack/socket-mode": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/@slack/socket-mode/-/socket-mode-1.3.6.tgz", + "integrity": "sha512-G+im7OP7jVqHhiNSdHgv2VVrnN5U7KY845/5EZimZkrD4ZmtV0P3BiWkgeJhPtdLuM7C7i6+M6h6Bh+S4OOalA==", + "dependencies": { + "@slack/logger": "^3.0.0", + "@slack/web-api": "^6.12.1", + "@types/node": ">=12.0.0", + "@types/ws": "^7.4.7", + "eventemitter3": "^5", + "finity": "^0.5.4", + "ws": "^7.5.3" + }, + "engines": { + "node": ">=12.13.0", + "npm": ">=6.12.0" + } + }, + "node_modules/@slack/socket-mode/node_modules/@slack/logger": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@slack/logger/-/logger-3.0.0.tgz", + "integrity": "sha512-DTuBFbqu4gGfajREEMrkq5jBhcnskinhr4+AnfJEk48zhVeEv3XnUKGIX98B74kxhYsIMfApGGySTn7V3b5yBA==", + "dependencies": { + "@types/node": ">=12.0.0" + }, + "engines": { + "node": ">= 12.13.0", + "npm": ">= 6.12.0" + } + }, + "node_modules/@slack/types": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/@slack/types/-/types-2.14.0.tgz", + "integrity": "sha512-n0EGm7ENQRxlXbgKSrQZL69grzg1gHLAVd+GlRVQJ1NSORo0FrApR7wql/gaKdu2n4TO83Sq/AmeUOqD60aXUA==", + "engines": { + "node": ">= 12.13.0", + "npm": ">= 6.12.0" + } + }, + "node_modules/@slack/web-api": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@slack/web-api/-/web-api-6.13.0.tgz", + "integrity": "sha512-dv65crIgdh9ZYHrevLU6XFHTQwTyDmNqEqzuIrV+Vqe/vgiG6w37oex5ePDU1RGm2IJ90H8iOvHFvzdEO/vB+g==", + "dependencies": { + "@slack/logger": "^3.0.0", + "@slack/types": "^2.11.0", + "@types/is-stream": "^1.1.0", + "@types/node": ">=12.0.0", + "axios": "^1.7.4", + "eventemitter3": "^3.1.0", + "form-data": "^2.5.0", + "is-electron": "2.2.2", + "is-stream": "^1.1.0", + "p-queue": "^6.6.1", + "p-retry": "^4.0.0" + }, + "engines": { + "node": ">= 12.13.0", + "npm": ">= 6.12.0" + } + }, + "node_modules/@slack/web-api/node_modules/@slack/logger": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@slack/logger/-/logger-3.0.0.tgz", + "integrity": "sha512-DTuBFbqu4gGfajREEMrkq5jBhcnskinhr4+AnfJEk48zhVeEv3XnUKGIX98B74kxhYsIMfApGGySTn7V3b5yBA==", + "dependencies": { + "@types/node": ">=12.0.0" + }, + "engines": { + "node": ">= 12.13.0", + "npm": ">= 6.12.0" + } + }, + "node_modules/@slack/web-api/node_modules/eventemitter3": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz", + "integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==" + }, + "node_modules/@slack/web-api/node_modules/form-data": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", + "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/@trivago/prettier-plugin-sort-imports": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@trivago/prettier-plugin-sort-imports/-/prettier-plugin-sort-imports-4.3.0.tgz", + "integrity": "sha512-r3n0onD3BTOVUNPhR4lhVK4/pABGpbA7bW3eumZnYdKaHkf1qEC+Mag6DPbGNuuh0eG8AaYj+YqmVHSiGslaTQ==", + "dev": true, + "dependencies": { + "@babel/generator": "7.17.7", + "@babel/parser": "^7.20.5", + "@babel/traverse": "7.23.2", + "@babel/types": "7.17.0", + "javascript-natural-sort": "0.7.1", + "lodash": "^4.17.21" + }, + "peerDependencies": { + "@vue/compiler-sfc": "3.x", + "prettier": "2.x - 3.x" + }, + "peerDependenciesMeta": { + "@vue/compiler-sfc": { + "optional": true + } + } + }, + "node_modules/@types/body-parser": { + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", + "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==" + }, + "node_modules/@types/express": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", + "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.19.5", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.5.tgz", + "integrity": "sha512-y6W03tvrACO72aijJ5uF02FRq5cgDR9lUxddQ8vyF+GvmjJQqbzDcJngEjURc+ZsG31VI3hODNZJ2URj86pzmg==", + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, + "node_modules/@types/http-errors": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", + "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==" + }, + "node_modules/@types/is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@types/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha512-jkZatu4QVbR60mpIzjINmtS1ZF4a/FqdTUTBeQDVOQ2PYyidtwFKr0B5G6ERukKwliq+7mIXvxyppwzG5EgRYg==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==" + }, + "node_modules/@types/jsonwebtoken": { + "version": "8.5.9", + "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-8.5.9.tgz", + "integrity": "sha512-272FMnFGzAVMGtu9tkr29hRL6bZj4Zs1KZNeHLnKqAvp06tAIcarTMwOh8/8bz4FmKRcMxZhZNeUAQsNLoiPhg==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/mdast": { + "version": "3.0.15", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.15.tgz", + "integrity": "sha512-LnwD+mUEfxWMa1QpDraczIn6k0Ee3SMicuYSSzS6ZYl2gKS09EClnJYGd8Du6rfc5r/GZEk5o1mRb8TaTj03sQ==", + "dependencies": { + "@types/unist": "^2" + } + }, + "node_modules/@types/mime": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==" + }, + "node_modules/@types/node": { + "version": "20.12.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.11.tgz", + "integrity": "sha512-vDg9PZ/zi+Nqp6boSOT7plNuthRugEKixDv5sFTIpkE89MmNtEArAShI4mxuX2+UrLEe9pxC1vm2cjm9YlWbJw==", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/offscreencanvas": { + "version": "2019.7.3", + "resolved": "https://registry.npmjs.org/@types/offscreencanvas/-/offscreencanvas-2019.7.3.tgz", + "integrity": "sha512-ieXiYmgSRXUDeOntE1InxjWyvEelZGP63M+cGuquuRLuIKKT1osnkXjxev9B7d1nXSug5vpunx+gNlbVxMlC9A==" + }, + "node_modules/@types/promise.allsettled": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/promise.allsettled/-/promise.allsettled-1.0.6.tgz", + "integrity": "sha512-wA0UT0HeT2fGHzIFV9kWpYz5mdoyLxKrTgMdZQM++5h6pYAFH73HXcQhefg24nD1yivUFEn5KU+EF4b+CXJ4Wg==" + }, + "node_modules/@types/qs": { + "version": "6.9.15", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.15.tgz", + "integrity": "sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg==" + }, + "node_modules/@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==" + }, + "node_modules/@types/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==" + }, + "node_modules/@types/send": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", + "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.15.7", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz", + "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==", + "dependencies": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "*" + } + }, + "node_modules/@types/tsscmp": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@types/tsscmp/-/tsscmp-1.0.2.tgz", + "integrity": "sha512-cy7BRSU8GYYgxjcx0Py+8lo5MthuDhlyu076KUcYzVNXL23luYgRHkMG2fIFEc6neckeh/ntP82mw+U4QjZq+g==" + }, + "node_modules/@types/unist": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==" + }, + "node_modules/@types/word-extractor": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/word-extractor/-/word-extractor-1.0.5.tgz", + "integrity": "sha512-9MF3n+GILMzdR6i78R8a7z3/AnPJh3nnt7JjkM8KtjV1M5KZDqLJ8P7tWBMI6YqqnDus+NMoUywUa5kvvyw8yw==" + }, + "node_modules/@types/ws": { + "version": "7.4.7", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", + "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@vitest/coverage-v8": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-1.6.1.tgz", + "integrity": "sha512-6YeRZwuO4oTGKxD3bijok756oktHSIm3eczVVzNe3scqzuhLwltIF3S9ZL/vwOVIpURmU6SnZhziXXAfw8/Qlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ampproject/remapping": "^2.2.1", + "@bcoe/v8-coverage": "^0.2.3", + "debug": "^4.3.4", + "istanbul-lib-coverage": "^3.2.2", + "istanbul-lib-report": "^3.0.1", + "istanbul-lib-source-maps": "^5.0.4", + "istanbul-reports": "^3.1.6", + "magic-string": "^0.30.5", + "magicast": "^0.3.3", + "picocolors": "^1.0.0", + "std-env": "^3.5.0", + "strip-literal": "^2.0.0", + "test-exclude": "^6.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "vitest": "1.6.1" + } + }, + "node_modules/@vitest/expect": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.6.1.tgz", + "integrity": "sha512-jXL+9+ZNIJKruofqXuuTClf44eSpcHlgj3CiuNihUF3Ioujtmc0zIa3UJOW5RjDK1YLBJZnWBlPuqhYycLioog==", + "license": "MIT", + "dependencies": { + "@vitest/spy": "1.6.1", + "@vitest/utils": "1.6.1", + "chai": "^4.3.10" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.6.1.tgz", + "integrity": "sha512-3nSnYXkVkf3mXFfE7vVyPmi3Sazhb/2cfZGGs0JRzFsPFvAMBEcrweV1V1GsrstdXeKCTXlJbvnQwGWgEIHmOA==", + "license": "MIT", + "dependencies": { + "@vitest/utils": "1.6.1", + "p-limit": "^5.0.0", + "pathe": "^1.1.1" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner/node_modules/p-limit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-5.0.0.tgz", + "integrity": "sha512-/Eaoq+QyLSiXQ4lyYV23f14mZRQcXnxfHrN0vCai+ak9G0pp9iEQukIIZq5NccEvwRB8PUnZT0KsOoDCINS1qQ==", + "license": "MIT", + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@vitest/runner/node_modules/yocto-queue": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.1.1.tgz", + "integrity": "sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==", + "license": "MIT", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@vitest/snapshot": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.6.1.tgz", + "integrity": "sha512-WvidQuWAzU2p95u8GAKlRMqMyN1yOJkGHnx3M1PL9Raf7AQ1kwLKg04ADlCa3+OXUZE7BceOhVZiuWAbzCKcUQ==", + "license": "MIT", + "dependencies": { + "magic-string": "^0.30.5", + "pathe": "^1.1.1", + "pretty-format": "^29.7.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.6.1.tgz", + "integrity": "sha512-MGcMmpGkZebsMZhbQKkAf9CX5zGvjkBTqf8Zx3ApYWXr3wG+QvEu2eXWfnIIWYSJExIp4V9FCKDEeygzkYrXMw==", + "license": "MIT", + "dependencies": { + "tinyspy": "^2.2.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/ui": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/ui/-/ui-1.6.1.tgz", + "integrity": "sha512-xa57bCPGuzEFqGjPs3vVLyqareG8DX0uMkr5U/v5vLv5/ZUrBrPL7gzxzTJedEyZxFMfsozwTIbbYfEQVo3kgg==", + "license": "MIT", + "dependencies": { + "@vitest/utils": "1.6.1", + "fast-glob": "^3.3.2", + "fflate": "^0.8.1", + "flatted": "^3.2.9", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "sirv": "^2.0.4" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "vitest": "1.6.1" + } + }, + "node_modules/@vitest/utils": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.6.1.tgz", + "integrity": "sha512-jOrrUvXM4Av9ZWiG1EajNto0u96kWAhJ1LmPmJhXXQx/32MecEKd10pOLYgS2BQx1TgkGhloPU1ArDW2vvaY6g==", + "license": "MIT", + "dependencies": { + "diff-sequences": "^29.6.3", + "estree-walker": "^3.0.3", + "loupe": "^2.3.7", + "pretty-format": "^29.7.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "optional": true + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", + "license": "MIT", + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "optional": true, + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==" + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/aproba": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", + "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", + "optional": true + }, + "node_modules/are-we-there-yet": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz", + "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==", + "deprecated": "This package is no longer supported.", + "optional": true, + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz", + "integrity": "sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==", + "dependencies": { + "call-bind": "^1.0.5", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/array.prototype.map": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/array.prototype.map/-/array.prototype.map-1.0.7.tgz", + "integrity": "sha512-XpcFfLoBEAhezrrNw1V+yLXkE7M6uR7xJEsxbG6c/V9v043qurwVJB9r9UTnoSioFDoz1i1VOydpWGmJpfVZbg==", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-array-method-boxes-properly": "^1.0.0", + "es-object-atoms": "^1.0.0", + "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz", + "integrity": "sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==", + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "es-abstract": "^1.22.3", + "es-errors": "^1.2.1", + "get-intrinsic": "^1.2.3", + "is-array-buffer": "^3.0.4", + "is-shared-array-buffer": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/axios": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz", + "integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/bail": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/bail/-/bail-1.0.5.tgz", + "integrity": "sha512-xFbRxM1tahm08yHBP16MMjVUAvDaBMD38zsM9EMAUN61omwLmKlOpB/Zku5QkjZ8TZ4vn53pj+t518cH0S03RQ==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/body-parser": { + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.13.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/body-parser/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/body-parser/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "engines": { + "node": "*" + } + }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" + }, + "node_modules/bundle-require": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-4.2.1.tgz", + "integrity": "sha512-7Q/6vkyYAwOmQNRw75x+4yRtZCZJXUDmHHlFdkiV0wgv/reNjtJwpu1jPJ0w2kbEpIM0uoKI3S4/f39dU7AjSA==", + "dependencies": { + "load-tsconfig": "^0.2.3" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "peerDependencies": { + "esbuild": ">=0.17" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/call-bind": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/canvas": { + "version": "2.11.2", + "resolved": "https://registry.npmjs.org/canvas/-/canvas-2.11.2.tgz", + "integrity": "sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "@mapbox/node-pre-gyp": "^1.0.0", + "nan": "^2.17.0", + "simple-get": "^3.0.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/ccount": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-1.1.0.tgz", + "integrity": "sha512-vlNK021QdI7PNeiUh/lKkC/mNHHfV0m/Ad5JoI0TYtlBnJAslM/JIkm/tGC88bkLIwO6OQ5uV6ztS6kVAtCDlg==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/chai": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.5.0.tgz", + "integrity": "sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==", + "license": "MIT", + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", + "pathval": "^1.1.1", + "type-detect": "^4.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/character-entities": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.4.tgz", + "integrity": "sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz", + "integrity": "sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-reference-invalid": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz", + "integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/check-error": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "license": "MIT", + "dependencies": { + "get-func-name": "^2.0.2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "optional": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + }, + "node_modules/color-support": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", + "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", + "optional": true, + "bin": { + "color-support": "bin.js" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/commander": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", + "engines": { + "node": ">=18" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/confbox": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz", + "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==", + "license": "MIT" + }, + "node_modules/console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", + "optional": true + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/data-view-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", + "integrity": "sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==", + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.1.tgz", + "integrity": "sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==", + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz", + "integrity": "sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==", + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/debug": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decompress-response": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", + "integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==", + "optional": true, + "dependencies": { + "mimic-response": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/deep-eql": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.4.tgz", + "integrity": "sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==", + "license": "MIT", + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", + "optional": true + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/detect-libc": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", + "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==", + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dir-glob/node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" + }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/es-abstract": { + "version": "1.23.3", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz", + "integrity": "sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==", + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "arraybuffer.prototype.slice": "^1.0.3", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "data-view-buffer": "^1.0.1", + "data-view-byte-length": "^1.0.1", + "data-view-byte-offset": "^1.0.0", + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-set-tostringtag": "^2.0.3", + "es-to-primitive": "^1.2.1", + "function.prototype.name": "^1.1.6", + "get-intrinsic": "^1.2.4", + "get-symbol-description": "^1.0.2", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.0.3", + "has-symbols": "^1.0.3", + "hasown": "^2.0.2", + "internal-slot": "^1.0.7", + "is-array-buffer": "^3.0.4", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.1", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.3", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.13", + "is-weakref": "^1.0.2", + "object-inspect": "^1.13.1", + "object-keys": "^1.1.1", + "object.assign": "^4.1.5", + "regexp.prototype.flags": "^1.5.2", + "safe-array-concat": "^1.1.2", + "safe-regex-test": "^1.0.3", + "string.prototype.trim": "^1.2.9", + "string.prototype.trimend": "^1.0.8", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.2", + "typed-array-byte-length": "^1.0.1", + "typed-array-byte-offset": "^1.0.2", + "typed-array-length": "^1.0.6", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.15" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-array-method-boxes-properly": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", + "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==" + }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-get-iterator": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.3.tgz", + "integrity": "sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "has-symbols": "^1.0.3", + "is-arguments": "^1.1.1", + "is-map": "^2.0.2", + "is-set": "^2.0.2", + "is-string": "^1.0.7", + "isarray": "^2.0.5", + "stop-iteration-iterator": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-object-atoms": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz", + "integrity": "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz", + "integrity": "sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==", + "dependencies": { + "get-intrinsic": "^1.2.4", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/esbuild": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/eslint": { + "version": "9.7.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.7.0.tgz", + "integrity": "sha512-FzJ9D/0nGiCGBf8UXO/IGLTgLVzIxze1zpfA8Ton2mjLovXdAPlYDv+MQDcqj3TmrhAGYfOpz9RfR+ent0AgAw==", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.11.0", + "@eslint/config-array": "^0.17.0", + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "9.7.0", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.3.0", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.0.2", + "eslint-visitor-keys": "^4.0.0", + "espree": "^10.1.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + } + }, + "node_modules/eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-plugin-prettier": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz", + "integrity": "sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw==", + "dev": true, + "dependencies": { + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.8.6" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-plugin-prettier" + }, + "peerDependencies": { + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "eslint-config-prettier": "*", + "prettier": ">=3.0.0" + }, + "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, + "eslint-config-prettier": { + "optional": true + } + } + }, + "node_modules/eslint-scope": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.0.2.tgz", + "integrity": "sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", + "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/eslint/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/eslint/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/eslint/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/espree": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.1.0.tgz", + "integrity": "sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==", + "dependencies": { + "acorn": "^8.12.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" + }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/execa/node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/express": { + "version": "4.21.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", + "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.3", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.7.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.3.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.12", + "proxy-addr": "~2.0.7", + "qs": "6.13.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.19.0", + "serve-static": "1.16.2", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/express/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/express/node_modules/path-to-regexp": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", + "license": "MIT" + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "node_modules/fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" + }, + "node_modules/fastq": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", + "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "dependencies": { + "pend": "~1.2.0" + } + }, + "node_modules/fflate": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", + "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==", + "license": "MIT" + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/finalhandler": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/finalhandler/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/finalhandler/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/finity": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/finity/-/finity-0.5.4.tgz", + "integrity": "sha512-3l+5/1tuw616Lgb0QBimxfdd2TqaDGpfCBpfX6EqtFmqUV3FtQnVEX4Aa62DagYEqnsTIjZcTfbq9msDbXYgyA==" + }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", + "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==" + }, + "node_modules/follow-redirects": { + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dependencies": { + "is-callable": "^1.1.3" + } + }, + "node_modules/foreground-child": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.1.tgz", + "integrity": "sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==", + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/foreground-child/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fs-extra": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", + "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "optional": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "optional": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "devOptional": true + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/function.prototype.name": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", + "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "functions-have-names": "^1.2.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gauge": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", + "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==", + "deprecated": "This package is no longer supported.", + "optional": true, + "dependencies": { + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.2", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.1", + "object-assign": "^4.1.1", + "signal-exit": "^3.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/get-func-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-symbol-description": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.2.tgz", + "integrity": "sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==", + "dependencies": { + "call-bind": "^1.0.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "devOptional": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globrex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", + "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==" + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "node_modules/handlebars": { + "version": "4.7.8", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", + "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.2", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, + "node_modules/handlebars/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "engines": { + "node": ">=4" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", + "optional": true + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==" + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "optional": true, + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ignore": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", + "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", + "engines": { + "node": ">= 4" + } + }, + "node_modules/immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "devOptional": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/internal-slot": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz", + "integrity": "sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==", + "dependencies": { + "es-errors": "^1.3.0", + "hasown": "^2.0.0", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-alphabetical": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.4.tgz", + "integrity": "sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-alphanumerical": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.4.tgz", + "integrity": "sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==", + "dependencies": { + "is-alphabetical": "^1.0.0", + "is-decimal": "^1.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-array-buffer": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz", + "integrity": "sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" + }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-buffer": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "engines": { + "node": ">=4" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.14.0.tgz", + "integrity": "sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A==", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-data-view": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz", + "integrity": "sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==", + "dependencies": { + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-decimal": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.4.tgz", + "integrity": "sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-electron": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/is-electron/-/is-electron-2.2.2.tgz", + "integrity": "sha512-FO/Rhvz5tuw4MCWkpMzHFKWD2LsfHzIb7i6MdPYZ/KW7AlxawyLkqdy+jPZP1WubqEADE3O4FUENlJHDfQASRg==" + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-hexadecimal": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz", + "integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-map": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", + "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-set": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", + "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz", + "integrity": "sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==", + "dependencies": { + "call-bind": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz", + "integrity": "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==", + "dependencies": { + "which-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-report/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-5.0.6.tgz", + "integrity": "sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.23", + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", + "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", + "dev": true, + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/iterate-iterator": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/iterate-iterator/-/iterate-iterator-1.0.2.tgz", + "integrity": "sha512-t91HubM4ZDQ70M9wqp+pcNpu8OyJ9UAtXntT/Bcsvp5tZMnz9vRa+IunKXeI8AnfZMTv0jNuVEmGeLSMjVvfPw==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/iterate-value": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/iterate-value/-/iterate-value-1.0.2.tgz", + "integrity": "sha512-A6fMAio4D2ot2r/TYzr4yUWrmwNdsN5xL7+HUiyACE4DXm+q8HtPcnFTp+NnW3k4N05tZ7FVYFFb2CR13NxyHQ==", + "dependencies": { + "es-get-iterator": "^1.0.2", + "iterate-iterator": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/javascript-natural-sort": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz", + "integrity": "sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==", + "dev": true + }, + "node_modules/joycon": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", + "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", + "engines": { + "node": ">=10" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" + }, + "node_modules/json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==" + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/jsonwebtoken": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", + "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", + "dependencies": { + "jws": "^3.2.2", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, + "node_modules/jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "dependencies": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lie": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", + "integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==", + "dependencies": { + "immediate": "~3.0.5" + } + }, + "node_modules/lilconfig": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.2.tgz", + "integrity": "sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow==", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" + }, + "node_modules/load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/load-tsconfig": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/load-tsconfig/-/load-tsconfig-0.2.5.tgz", + "integrity": "sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/local-pkg": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.5.1.tgz", + "integrity": "sha512-9rrA30MRRP3gBD3HTGnC6cDFpaE1kVDWxWgqWJUN0RvDNAo+Nz/9GxB+nHOH0ifbVFy0hSA1V6vFDvnx54lTEQ==", + "license": "MIT", + "dependencies": { + "mlly": "^1.7.3", + "pkg-types": "^1.2.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/localforage": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz", + "integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==", + "dependencies": { + "lie": "3.1.1" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==" + }, + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==" + }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==" + }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==" + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==" + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==" + }, + "node_modules/lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==" + }, + "node_modules/longest-streak": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-2.0.4.tgz", + "integrity": "sha512-vM6rUVCVUJJt33bnmHiZEvr7wPT78ztX7rojL+LW51bHtLh6HTjx84LA5W4+oa6aKEJA7jJu5LR6vQRBpA5DVg==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/loupe": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", + "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", + "license": "MIT", + "dependencies": { + "get-func-name": "^2.0.1" + } + }, + "node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==" + }, + "node_modules/magic-string": { + "version": "0.30.17", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", + "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, + "node_modules/magicast": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.4.tgz", + "integrity": "sha512-TyDF/Pn36bBji9rWKHlZe+PZb6Mx5V8IHCSxk7X4aljM4e/vyDvZZYwHewdVaqiA0nb3ghfHU/6AUpDxWoER2Q==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.24.4", + "@babel/types": "^7.24.0", + "source-map-js": "^1.2.0" + } + }, + "node_modules/magicast/node_modules/@babel/types": { + "version": "7.24.9", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.9.tgz", + "integrity": "sha512-xm8XrMKz0IlUdocVbYJe0Z9xEgidU7msskG8BbhnTPK/HZ2z/7FP7ykqPgrUH+C+r414mNfNWam1f2vqOjqjYQ==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.8", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/markdown-table": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-2.0.0.tgz", + "integrity": "sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A==", + "dependencies": { + "repeat-string": "^1.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdast-util-find-and-replace": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-1.1.1.tgz", + "integrity": "sha512-9cKl33Y21lyckGzpSmEQnIDjEfeeWelN5s1kUW1LwdB0Fkuq2u+4GdqcGEygYxJE8GVqCl0741bYXHgamfWAZA==", + "dependencies": { + "escape-string-regexp": "^4.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-find-and-replace/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mdast-util-from-markdown": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.5.tgz", + "integrity": "sha512-2hkTXtYYnr+NubD/g6KGBS/0mFmBcifAsI0yIWRiRo0PjVs6SSOSOdtzbp6kSGnShDN6G5aWZpKQ2lWRy27mWQ==", + "dependencies": { + "@types/mdast": "^3.0.0", + "mdast-util-to-string": "^2.0.0", + "micromark": "~2.11.0", + "parse-entities": "^2.0.0", + "unist-util-stringify-position": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-0.1.2.tgz", + "integrity": "sha512-NNkhDx/qYcuOWB7xHUGWZYVXvjPFFd6afg6/e2g+SV4r9q5XUcCbV4Wfa3DLYIiD+xAEZc6K4MGaE/m0KDcPwQ==", + "dependencies": { + "mdast-util-gfm-autolink-literal": "^0.1.0", + "mdast-util-gfm-strikethrough": "^0.2.0", + "mdast-util-gfm-table": "^0.1.0", + "mdast-util-gfm-task-list-item": "^0.1.0", + "mdast-util-to-markdown": "^0.6.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-autolink-literal": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-0.1.3.tgz", + "integrity": "sha512-GjmLjWrXg1wqMIO9+ZsRik/s7PLwTaeCHVB7vRxUwLntZc8mzmTsLVr6HW1yLokcnhfURsn5zmSVdi3/xWWu1A==", + "dependencies": { + "ccount": "^1.0.0", + "mdast-util-find-and-replace": "^1.1.0", + "micromark": "^2.11.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-strikethrough": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-0.2.3.tgz", + "integrity": "sha512-5OQLXpt6qdbttcDG/UxYY7Yjj3e8P7X16LzvpX8pIQPYJ/C2Z1qFGMmcw+1PZMUM3Z8wt8NRfYTvCni93mgsgA==", + "dependencies": { + "mdast-util-to-markdown": "^0.6.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-table": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-0.1.6.tgz", + "integrity": "sha512-j4yDxQ66AJSBwGkbpFEp9uG/LS1tZV3P33fN1gkyRB2LoRL+RR3f76m0HPHaby6F4Z5xr9Fv1URmATlRRUIpRQ==", + "dependencies": { + "markdown-table": "^2.0.0", + "mdast-util-to-markdown": "~0.6.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-task-list-item": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-0.1.6.tgz", + "integrity": "sha512-/d51FFIfPsSmCIRNp7E6pozM9z1GYPIkSy1urQ8s/o4TC22BZ7DqfHFWiqBD23bc7J3vV1Fc9O4QIHBlfuit8A==", + "dependencies": { + "mdast-util-to-markdown": "~0.6.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-markdown": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-0.6.5.tgz", + "integrity": "sha512-XeV9sDE7ZlOQvs45C9UKMtfTcctcaj/pGwH8YLbMHoMOXNNCn2LsqVQOqrF1+/NU8lKDAqozme9SCXWyo9oAcQ==", + "dependencies": { + "@types/unist": "^2.0.0", + "longest-streak": "^2.0.0", + "mdast-util-to-string": "^2.0.0", + "parse-entities": "^2.0.0", + "repeat-string": "^1.0.0", + "zwitch": "^1.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-2.0.0.tgz", + "integrity": "sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/memorystream": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", + "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==", + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/micromark": { + "version": "2.11.4", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-2.11.4.tgz", + "integrity": "sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "debug": "^4.0.0", + "parse-entities": "^2.0.0" + } + }, + "node_modules/micromark-extension-gfm": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-0.3.3.tgz", + "integrity": "sha512-oVN4zv5/tAIA+l3GbMi7lWeYpJ14oQyJ3uEim20ktYFAcfX1x3LNlFGGlmrZHt7u9YlKExmyJdDGaTt6cMSR/A==", + "dependencies": { + "micromark": "~2.11.0", + "micromark-extension-gfm-autolink-literal": "~0.5.0", + "micromark-extension-gfm-strikethrough": "~0.6.5", + "micromark-extension-gfm-table": "~0.4.0", + "micromark-extension-gfm-tagfilter": "~0.3.0", + "micromark-extension-gfm-task-list-item": "~0.3.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-autolink-literal": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-0.5.7.tgz", + "integrity": "sha512-ePiDGH0/lhcngCe8FtH4ARFoxKTUelMp4L7Gg2pujYD5CSMb9PbblnyL+AAMud/SNMyusbS2XDSiPIRcQoNFAw==", + "dependencies": { + "micromark": "~2.11.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-strikethrough": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-0.6.5.tgz", + "integrity": "sha512-PpOKlgokpQRwUesRwWEp+fHjGGkZEejj83k9gU5iXCbDG+XBA92BqnRKYJdfqfkrRcZRgGuPuXb7DaK/DmxOhw==", + "dependencies": { + "micromark": "~2.11.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-table": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-0.4.3.tgz", + "integrity": "sha512-hVGvESPq0fk6ALWtomcwmgLvH8ZSVpcPjzi0AjPclB9FsVRgMtGZkUcpE0zgjOCFAznKepF4z3hX8z6e3HODdA==", + "dependencies": { + "micromark": "~2.11.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-tagfilter": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-0.3.0.tgz", + "integrity": "sha512-9GU0xBatryXifL//FJH+tAZ6i240xQuFrSL7mYi8f4oZSbc+NvXjkrHemeYP0+L4ZUT+Ptz3b95zhUZnMtoi/Q==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-task-list-item": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-0.3.3.tgz", + "integrity": "sha512-0zvM5iSLKrc/NQl84pZSjGo66aTGd57C1idmlWmE87lkMcXrTxg1uXa/nXomxJytoje9trP0NDLvw4bZ/Z/XCQ==", + "dependencies": { + "micromark": "~2.11.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/mimic-response": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz", + "integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==", + "optional": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "optional": true, + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "optional": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "optional": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mlly": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.4.tgz", + "integrity": "sha512-qmdSIPC4bDJXgZTCR7XosJiNKySV7O215tsPtDN9iEO/7q/76b/ijtgRu/+epFXSJhijtTCCGp3DWS549P3xKw==", + "license": "MIT", + "dependencies": { + "acorn": "^8.14.0", + "pathe": "^2.0.1", + "pkg-types": "^1.3.0", + "ufo": "^1.5.4" + } + }, + "node_modules/mlly/node_modules/pathe": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.2.tgz", + "integrity": "sha512-15Ztpk+nov8DR524R4BF7uEuzESgzUEAV4Ah7CUMNGXdE5ELuvxElxGXndBl32vMSsWa1jpNf22Z+Er3sKwq+w==", + "license": "MIT" + }, + "node_modules/mrmime": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.0.tgz", + "integrity": "sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "node_modules/nan": { + "version": "2.20.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.20.0.tgz", + "integrity": "sha512-bk3gXBZDGILuuo/6sKtr0DQmSThYHLtNCdSdXk9YkxD/jK6X2vmCyyXBBxyqZ4XcnzTyYEAThfX3DCEnLf6igw==", + "optional": true + }, + "node_modules/nanoid": { + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" + }, + "node_modules/nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "optional": true, + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/nopt": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "optional": true, + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/normalize-package-data/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-all": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz", + "integrity": "sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "chalk": "^2.4.1", + "cross-spawn": "^6.0.5", + "memorystream": "^0.3.1", + "minimatch": "^3.0.4", + "pidtree": "^0.3.0", + "read-pkg": "^3.0.0", + "shell-quote": "^1.6.1", + "string.prototype.padend": "^3.0.0" + }, + "bin": { + "npm-run-all": "bin/npm-run-all/index.js", + "run-p": "bin/run-p/index.js", + "run-s": "bin/run-s/index.js" + }, + "engines": { + "node": ">= 4" + } + }, + "node_modules/npm-run-all/node_modules/cross-spawn": { + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz", + "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", + "dependencies": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "engines": { + "node": ">=4.8" + } + }, + "node_modules/npm-run-all/node_modules/path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", + "engines": { + "node": ">=4" + } + }, + "node_modules/npm-run-all/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/npm-run-all/node_modules/shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-all/node_modules/shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-all/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npmlog": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz", + "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==", + "deprecated": "This package is no longer supported.", + "optional": true, + "dependencies": { + "are-we-there-yet": "^2.0.0", + "console-control-strings": "^1.1.0", + "gauge": "^3.0.0", + "set-blocking": "^2.0.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", + "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.5.tgz", + "integrity": "sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==", + "dependencies": { + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "devOptional": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/openapi-typescript-codegen": { + "version": "0.29.0", + "resolved": "https://registry.npmjs.org/openapi-typescript-codegen/-/openapi-typescript-codegen-0.29.0.tgz", + "integrity": "sha512-/wC42PkD0LGjDTEULa/XiWQbv4E9NwLjwLjsaJ/62yOsoYhwvmBR31kPttn1DzQ2OlGe5stACcF/EIkZk43M6w==", + "dependencies": { + "@apidevtools/json-schema-ref-parser": "^11.5.4", + "camelcase": "^6.3.0", + "commander": "^12.0.0", + "fs-extra": "^11.2.0", + "handlebars": "^4.7.8" + }, + "bin": { + "openapi": "bin/index.js" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==", + "engines": { + "node": ">=4" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-queue": { + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-6.6.2.tgz", + "integrity": "sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==", + "dependencies": { + "eventemitter3": "^4.0.4", + "p-timeout": "^3.2.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-queue/node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" + }, + "node_modules/p-retry": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.6.2.tgz", + "integrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==", + "dependencies": { + "@types/retry": "0.12.0", + "retry": "^0.13.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-timeout": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz", + "integrity": "sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==", + "dependencies": { + "p-finally": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/package-json-from-dist": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", + "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==" + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-entities": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-2.0.0.tgz", + "integrity": "sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==", + "dependencies": { + "character-entities": "^1.0.0", + "character-entities-legacy": "^1.0.0", + "character-reference-invalid": "^1.0.0", + "is-alphanumerical": "^1.0.0", + "is-decimal": "^1.0.0", + "is-hexadecimal": "^1.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "dependencies": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "devOptional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-to-regexp": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.2.0.tgz", + "integrity": "sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==", + "engines": { + "node": ">=16" + } + }, + "node_modules/path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/path2d": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/path2d/-/path2d-0.2.1.tgz", + "integrity": "sha512-Fl2z/BHvkTNvkuBzYTpTuirHZg6wW9z8+4SND/3mDTEcYbbNKWAy21dz9D3ePNNwrrK8pqZO5vLPZ1hLF6T7XA==", + "optional": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/pathe": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", + "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", + "license": "MIT" + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/pdfjs-dist": { + "version": "4.2.67", + "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-4.2.67.tgz", + "integrity": "sha512-rJmuBDFpD7cqC8WIkQUEClyB4UAH05K4AsyewToMTp2gSy3Rrx8c1ydAVqlJlGv3yZSOrhEERQU/4ScQQFlLHA==", + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "canvas": "^2.11.2", + "path2d": "^0.2.0" + } + }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==" + }, + "node_modules/picocolors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", + "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pidtree": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.1.tgz", + "integrity": "sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==", + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "engines": { + "node": ">=4" + } + }, + "node_modules/pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-types": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz", + "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==", + "license": "MIT", + "dependencies": { + "confbox": "^0.1.8", + "mlly": "^1.7.4", + "pathe": "^2.0.1" + } + }, + "node_modules/pkg-types/node_modules/pathe": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.2.tgz", + "integrity": "sha512-15Ztpk+nov8DR524R4BF7uEuzESgzUEAV4Ah7CUMNGXdE5ELuvxElxGXndBl32vMSsWa1jpNf22Z+Er3sKwq+w==", + "license": "MIT" + }, + "node_modules/possible-typed-array-names": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", + "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/postcss": { + "version": "8.4.47", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz", + "integrity": "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.1.0", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-load-config": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-4.0.2.tgz", + "integrity": "sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "lilconfig": "^3.0.0", + "yaml": "^2.3.4" + }, + "engines": { + "node": ">= 14" + }, + "peerDependencies": { + "postcss": ">=8.0.9", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "postcss": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "dependencies": { + "fast-diff": "^1.1.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "license": "MIT", + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/prisma": { + "version": "5.20.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.20.0.tgz", + "integrity": "sha512-6obb3ucKgAnsGS9x9gLOe8qa51XxvJ3vLQtmyf52CTey1Qcez3A6W6ROH5HIz5Q5bW+0VpmZb8WBohieMFGpig==", + "hasInstallScript": true, + "dependencies": { + "@prisma/engines": "5.20.0" + }, + "bin": { + "prisma": "build/index.js" + }, + "engines": { + "node": ">=16.13" + }, + "optionalDependencies": { + "fsevents": "2.3.3" + } + }, + "node_modules/promise.allsettled": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/promise.allsettled/-/promise.allsettled-1.0.7.tgz", + "integrity": "sha512-hezvKvQQmsFkOdrZfYxUxkyxl8mgFQeT259Ajj9PXdbg9VzBCWrItOev72JyWxkCD5VSSqAeHmlN3tWx4DlmsA==", + "dependencies": { + "array.prototype.map": "^1.0.5", + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "iterate-value": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/qs": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "dependencies": { + "side-channel": "^1.0.6" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "license": "MIT" + }, + "node_modules/read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==", + "dependencies": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "optional": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz", + "integrity": "sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw==", + "dependencies": { + "call-bind": "^1.0.6", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "set-function-name": "^2.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/remark-gfm": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-1.0.0.tgz", + "integrity": "sha512-KfexHJCiqvrdBZVbQ6RopMZGwaXz6wFJEfByIuEwGf0arvITHjiKKZ1dpXujjH9KZdm1//XJQwgfnJ3lmXaDPA==", + "dependencies": { + "mdast-util-gfm": "^0.1.0", + "micromark-extension-gfm": "^0.3.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-parse": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-9.0.0.tgz", + "integrity": "sha512-geKatMwSzEXKHuzBNU1z676sGcDcFoChMK38TgdHJNAYfFtsfHDQG7MoJAjs6sgYMqyLduCYWDIWZIxiPeafEw==", + "dependencies": { + "mdast-util-from-markdown": "^0.8.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-stringify": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-9.0.1.tgz", + "integrity": "sha512-mWmNg3ZtESvZS8fv5PTvaPckdL4iNlCHTt8/e/8oN08nArHRHjNZMKzA/YW3+p7/lYqIw4nx1XsjCBo/AxNChg==", + "dependencies": { + "mdast-util-to-markdown": "^0.6.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "engines": { + "node": ">=4" + } + }, + "node_modules/retry": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", + "engines": { + "node": ">= 4" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "optional": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rollup": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.22.4.tgz", + "integrity": "sha512-vD8HJ5raRcWOyymsR6Z3o6+RzfEPCnVLMFJ6vRslO1jt4LO6dUo5Qnpg7y4RkZFM2DMe3WUirkI5c16onjrc6A==", + "dependencies": { + "@types/estree": "1.0.5" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.22.4", + "@rollup/rollup-android-arm64": "4.22.4", + "@rollup/rollup-darwin-arm64": "4.22.4", + "@rollup/rollup-darwin-x64": "4.22.4", + "@rollup/rollup-linux-arm-gnueabihf": "4.22.4", + "@rollup/rollup-linux-arm-musleabihf": "4.22.4", + "@rollup/rollup-linux-arm64-gnu": "4.22.4", + "@rollup/rollup-linux-arm64-musl": "4.22.4", + "@rollup/rollup-linux-powerpc64le-gnu": "4.22.4", + "@rollup/rollup-linux-riscv64-gnu": "4.22.4", + "@rollup/rollup-linux-s390x-gnu": "4.22.4", + "@rollup/rollup-linux-x64-gnu": "4.22.4", + "@rollup/rollup-linux-x64-musl": "4.22.4", + "@rollup/rollup-win32-arm64-msvc": "4.22.4", + "@rollup/rollup-win32-ia32-msvc": "4.22.4", + "@rollup/rollup-win32-x64-msvc": "4.22.4", + "fsevents": "~2.3.2" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-array-concat": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.2.tgz", + "integrity": "sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==", + "dependencies": { + "call-bind": "^1.0.7", + "get-intrinsic": "^1.2.4", + "has-symbols": "^1.0.3", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safe-regex-test": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.3.tgz", + "integrity": "sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==", + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-regex": "^1.1.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/saxes": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-5.0.1.tgz", + "integrity": "sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw==", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/send": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/send/node_modules/debug/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/serve-static": { + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.19.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", + "optional": true + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "engines": { + "node": ">=8" + } + }, + "node_modules/shell-quote": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz", + "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "license": "ISC" + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "optional": true + }, + "node_modules/simple-get": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.1.tgz", + "integrity": "sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==", + "optional": true, + "dependencies": { + "decompress-response": "^4.2.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "node_modules/sirv": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/sirv/-/sirv-2.0.4.tgz", + "integrity": "sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==", + "license": "MIT", + "dependencies": { + "@polka/url": "^1.0.0-next.24", + "mrmime": "^2.0.0", + "totalist": "^3.0.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/slackify-markdown": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/slackify-markdown/-/slackify-markdown-4.4.0.tgz", + "integrity": "sha512-a2b0Rh4aPi3PYt23N0vxPn7emkQtShewhLX8uIiXOMlPBAXRki+/9kEXJztZr1Oo9rDb1YxScGuZ0D2ubLPhvQ==", + "dependencies": { + "mdast-util-to-markdown": "^0.6.2", + "remark-gfm": "^1.0.0", + "remark-parse": "^9.0.0", + "remark-stringify": "^9.0.1", + "unified": "^9.0.0", + "unist-util-remove": "^2.0.1", + "unist-util-visit": "^2.0.3" + } + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==" + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.18", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.18.tgz", + "integrity": "sha512-xxRs31BqRYHwiMzudOrpSiHtZ8i/GeionCBDSilhYRj+9gIcI8wCZTlXZKu9vZIVqViP3dcp9qE5G6AlIaD+TQ==" + }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "license": "MIT" + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/std-env": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.8.0.tgz", + "integrity": "sha512-Bc3YwwCB+OzldMxOXJIIvC6cPRWr/LxOp48CdQTOkPyk/t4JWWJbrilwBd7RJzKV8QW7tJkcgAmeuLLJugl5/w==", + "license": "MIT" + }, + "node_modules/stop-iteration-iterator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.0.0.tgz", + "integrity": "sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ==", + "dependencies": { + "internal-slot": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "optional": true, + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string.prototype.padend": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.1.6.tgz", + "integrity": "sha512-XZpspuSB7vJWhvJc9DLSlrXl1mcA2BdoY5jjnS135ydXqLoqhs96JjDtCkjJEQHvfqZIp9hBuBMgI589peyx9Q==", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz", + "integrity": "sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz", + "integrity": "sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-literal": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-2.1.1.tgz", + "integrity": "sha512-631UJ6O00eNGfMiWG78ck80dfBab8X6IVFB51jZK5Icd7XAs60Z5y7QdSd/wGIklnWvRbUNloVzhOKKmutxQ6Q==", + "license": "MIT", + "dependencies": { + "js-tokens": "^9.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/strip-literal/node_modules/js-tokens": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.1.tgz", + "integrity": "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==", + "license": "MIT" + }, + "node_modules/sucrase": { + "version": "3.35.0", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.0.tgz", + "integrity": "sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.2", + "commander": "^4.0.0", + "glob": "^10.3.10", + "lines-and-columns": "^1.1.6", + "mz": "^2.7.0", + "pirates": "^4.0.1", + "ts-interface-checker": "^0.1.9" + }, + "bin": { + "sucrase": "bin/sucrase", + "sucrase-node": "bin/sucrase-node" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/sucrase/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/sucrase/node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "engines": { + "node": ">= 6" + } + }, + "node_modules/sucrase/node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/sucrase/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/sucrase/node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/synckit": { + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.8.tgz", + "integrity": "sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ==", + "dev": true, + "dependencies": { + "@pkgr/core": "^0.1.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/tar": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "optional": true, + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==" + }, + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dependencies": { + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "license": "MIT" + }, + "node_modules/tinypool": { + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.8.4.tgz", + "integrity": "sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.2.1.tgz", + "integrity": "sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/totalist": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", + "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "optional": true + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "bin": { + "tree-kill": "cli.js" + } + }, + "node_modules/trough": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.5.tgz", + "integrity": "sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/ts-interface-checker": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", + "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==" + }, + "node_modules/tsconfck": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-3.1.1.tgz", + "integrity": "sha512-00eoI6WY57SvZEVjm13stEVE90VkEdJAFGgpFLTsZbJyW/LwFQ7uQxJHWpZ2hzSWgCPKc9AnBnNP+0X7o3hAmQ==", + "bin": { + "tsconfck": "bin/tsconfck.js" + }, + "engines": { + "node": "^18 || >=20" + }, + "peerDependencies": { + "typescript": "^5.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/tslib": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", + "dev": true + }, + "node_modules/tsscmp": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.6.tgz", + "integrity": "sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==", + "engines": { + "node": ">=0.6.x" + } + }, + "node_modules/tsup": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/tsup/-/tsup-8.1.0.tgz", + "integrity": "sha512-UFdfCAXukax+U6KzeTNO2kAARHcWxmKsnvSPXUcfA1D+kU05XDccCrkffCQpFaWDsZfV0jMyTsxU39VfCp6EOg==", + "dependencies": { + "bundle-require": "^4.0.0", + "cac": "^6.7.12", + "chokidar": "^3.5.1", + "debug": "^4.3.1", + "esbuild": "^0.21.4", + "execa": "^5.0.0", + "globby": "^11.0.3", + "joycon": "^3.0.1", + "postcss-load-config": "^4.0.1", + "resolve-from": "^5.0.0", + "rollup": "^4.0.2", + "source-map": "0.8.0-beta.0", + "sucrase": "^3.20.3", + "tree-kill": "^1.2.2" + }, + "bin": { + "tsup": "dist/cli-default.js", + "tsup-node": "dist/cli-node.js" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@microsoft/api-extractor": "^7.36.0", + "@swc/core": "^1", + "postcss": "^8.4.12", + "typescript": ">=4.5.0" + }, + "peerDependenciesMeta": { + "@microsoft/api-extractor": { + "optional": true + }, + "@swc/core": { + "optional": true + }, + "postcss": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/tsup/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/tsup/node_modules/source-map": { + "version": "0.8.0-beta.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.8.0-beta.0.tgz", + "integrity": "sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==", + "dependencies": { + "whatwg-url": "^7.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/tsup/node_modules/tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/tsup/node_modules/webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" + }, + "node_modules/tsup/node_modules/whatwg-url": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", + "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", + "dependencies": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-detect": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz", + "integrity": "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz", + "integrity": "sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==", + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.1.tgz", + "integrity": "sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw==", + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.2.tgz", + "integrity": "sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA==", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.6.tgz", + "integrity": "sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==", + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typescript": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz", + "integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/ufo": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.4.tgz", + "integrity": "sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==", + "license": "MIT" + }, + "node_modules/uglify-js": { + "version": "3.18.0", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.18.0.tgz", + "integrity": "sha512-SyVVbcNBCk0dzr9XL/R/ySrmYf0s372K6/hFklzgcp2lBFyXtw4I7BOdDjlLhE1aVqaI/SHWXWmYdlZxuyF38A==", + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dependencies": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + }, + "node_modules/unified": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/unified/-/unified-9.2.2.tgz", + "integrity": "sha512-Sg7j110mtefBD+qunSLO1lqOEKdrwBFBrR6Qd8f4uwkhWNlbkaqwHse6e7QvD3AP/MNoJdEDLaf8OxYyoWgorQ==", + "dependencies": { + "bail": "^1.0.0", + "extend": "^3.0.0", + "is-buffer": "^2.0.0", + "is-plain-obj": "^2.0.0", + "trough": "^1.0.0", + "vfile": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-is": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.1.0.tgz", + "integrity": "sha512-ZOQSsnce92GrxSqlnEEseX0gi7GH9zTJZ0p9dtu87WRb/37mMPO2Ilx1s/t9vBHrFhbgweUwb+t7cIn5dxPhZg==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-remove": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unist-util-remove/-/unist-util-remove-2.1.0.tgz", + "integrity": "sha512-J8NYPyBm4baYLdCbjmf1bhPu45Cr1MWTm77qd9istEkzWpnN6O9tMsEbB2JhNnBCqGENRqEWomQ+He6au0B27Q==", + "dependencies": { + "unist-util-is": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-2.0.3.tgz", + "integrity": "sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==", + "dependencies": { + "@types/unist": "^2.0.2" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", + "integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.1.tgz", + "integrity": "sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "optional": true + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vfile": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-4.2.1.tgz", + "integrity": "sha512-O6AE4OskCG5S1emQ/4gl8zK586RqA3srz3nfK/Viy0UPToBc5Trp9BVFb1u0CjsKrAWwnpr4ifM/KBXPWwJbCA==", + "dependencies": { + "@types/unist": "^2.0.0", + "is-buffer": "^2.0.0", + "unist-util-stringify-position": "^2.0.0", + "vfile-message": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-2.0.4.tgz", + "integrity": "sha512-DjssxRGkMvifUOJre00juHoP9DPWuzjxKuMDrhNbk2TdaYYBNMStsNhEOt3idrtI12VQYM/1+iM0KOzXi4pxwQ==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-stringify-position": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vite": { + "version": "5.4.14", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.14.tgz", + "integrity": "sha512-EK5cY7Q1D8JNhSaPKVK4pwBFvaTmZxEnoKXLG/U9gmdDcihQGNzFlgIvaxezFR4glP1LsuiedwMBqCXH3wZccA==", + "license": "MIT", + "dependencies": { + "esbuild": "^0.21.3", + "postcss": "^8.4.43", + "rollup": "^4.20.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "node_modules/vite-node": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.6.1.tgz", + "integrity": "sha512-YAXkfvGtuTzwWbDSACdJSg4A4DZiAqckWe90Zapc/sEX3XvHcw1NdurM/6od8J207tSDqNbSsgdCacBgvJKFuA==", + "license": "MIT", + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.3.4", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "vite": "^5.0.0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/vite-tsconfig-paths": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/vite-tsconfig-paths/-/vite-tsconfig-paths-4.3.2.tgz", + "integrity": "sha512-0Vd/a6po6Q+86rPlntHye7F31zA2URZMbH8M3saAZ/xR9QoGN/L21bxEGfXdWmFdNkqPpRdxFT7nmNe12e9/uA==", + "dependencies": { + "debug": "^4.1.1", + "globrex": "^0.1.2", + "tsconfck": "^3.0.3" + }, + "peerDependencies": { + "vite": "*" + }, + "peerDependenciesMeta": { + "vite": { + "optional": true + } + } + }, + "node_modules/vitest": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.6.1.tgz", + "integrity": "sha512-Ljb1cnSJSivGN0LqXd/zmDbWEM0RNNg2t1QW/XUhYl/qPqyu7CsqeWtqQXHVaJsecLPuDoak2oJcZN2QoRIOag==", + "license": "MIT", + "dependencies": { + "@vitest/expect": "1.6.1", + "@vitest/runner": "1.6.1", + "@vitest/snapshot": "1.6.1", + "@vitest/spy": "1.6.1", + "@vitest/utils": "1.6.1", + "acorn-walk": "^8.3.2", + "chai": "^4.3.10", + "debug": "^4.3.4", + "execa": "^8.0.1", + "local-pkg": "^0.5.0", + "magic-string": "^0.30.5", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "std-env": "^3.5.0", + "strip-literal": "^2.0.0", + "tinybench": "^2.5.1", + "tinypool": "^0.8.3", + "vite": "^5.0.0", + "vite-node": "1.6.1", + "why-is-node-running": "^2.2.2" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@types/node": "^18.0.0 || >=20.0.0", + "@vitest/browser": "1.6.1", + "@vitest/ui": "1.6.1", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, + "node_modules/vitest/node_modules/execa": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/vitest/node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "license": "MIT", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vitest/node_modules/human-signals": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=16.17.0" + } + }, + "node_modules/vitest/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vitest/node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vitest/node_modules/npm-run-path": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", + "license": "MIT", + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vitest/node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "license": "MIT", + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vitest/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/vitest/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/vitest/node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "optional": true + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "optional": true, + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.15.tgz", + "integrity": "sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wide-align": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", + "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", + "optional": true, + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, + "node_modules/word-extractor": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/word-extractor/-/word-extractor-1.0.4.tgz", + "integrity": "sha512-PyAGZQ2gjnVA5kcZAOAxoYciCMaAvu0dbVlw/zxHphhy+3be8cDeYKHJPO8iedIM3Sx0arA/ugKTJyXhZNgo6g==", + "dependencies": { + "saxes": "^5.0.1", + "yauzl": "^2.10.0" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==" + }, + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "devOptional": true + }, + "node_modules/ws": { + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==" + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "optional": true + }, + "node_modules/yaml": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.5.tgz", + "integrity": "sha512-aBx2bnqDzVOyNKfsysjA2ms5ZlnjSAW2eG3/L5G/CSujfjLJTJsEw1bGw8kCf04KodQWk1pxlGnZ56CRxiawmg==", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zwitch": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-1.0.5.tgz", + "integrity": "sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + } + } +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/package.json b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/package.json new file mode 100644 index 0000000000000000000000000000000000000000..c5ffccbed46a6156958d4df40174ba76b7643614 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/package.json @@ -0,0 +1,57 @@ +{ + "name": "@cohere-ai/command-slack-bot", + "version": "0.0.0", + "private": true, + "scripts": { + "build": "npm-run-all --serial prisma:generate tsup:build", + "dev": "NODE_ENV=development tsup src/index.ts --watch --onSuccess \"node dist/index.js\"", + "format": "prettier --check '**/*.{ts,js,json,md,yml,yaml}'", + "format:write": "prettier --write '**/*.{ts,js,json,md,yml,yaml}'", + "lint": "npm-run-all --serial prisma:generate tsc:check eslint", + "prisma:generate": "prisma generate", + "prisma:migrate:deploy": "prisma migrate deploy", + "start:node": "node dist/index.js", + "start": "npm-run-all --serial prisma:migrate:deploy start:node", + "test": "npm-run-all --sequential test:coverage test:patch-report", + "test:coverage": "vitest run --coverage --reporter=default --reporter=json --outputFile.json=./coverage/report.json", + "test:patch-report": "node ./scripts/patchVitestReport.mjs", + "test:run": "vitest run", + "test:watch": "vitest --ui", + "tsc:check": "tsc --noEmit", + "tsup:build": "tsup src/index.ts", + "generate:client": "@hey-api/openapi-ts -i http://0.0.0.0:8000/openapi.json -o src/cohere-client/generated --useOptions --base http://0.0.0.0:8000 --name ToolkitClient" + }, + "dependencies": { + "@microsoft/fetch-event-source": "^2.0.1", + "@prisma/client": "^5.20.0", + "@sentry/node": "^7.64.0", + "@slack/bolt": "^3.18.0", + "@slack/web-api": "^6.12.0", + "@types/node": "20.12.11", + "@types/offscreencanvas": "^2019.7.3", + "@types/word-extractor": "^1.0.2", + "@vitest/ui": "^1.6.1", + "axios": "^1.7.4", + "dotenv": "^16.0.3", + "eslint": "^9.3.0", + "form-data": "^4.0.0", + "npm-run-all": "^4.1.5", + "openapi-typescript-codegen": "^0.29.0", + "pdfjs-dist": "4.2.67", + "prettier": "^3.2.5", + "prisma": "^5.14.0", + "slackify-markdown": "^4.4.0", + "tsup": "^8.0.0", + "typescript": "^5.4.5", + "vite": "^5.4.14", + "vite-tsconfig-paths": "^4.3.2", + "vitest": "^1.6.1", + "word-extractor": "^1.0.4" + }, + "devDependencies": { + "@trivago/prettier-plugin-sort-imports": "^4.3.0", + "@vitest/coverage-v8": "^1.6.1", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.1.3" + } +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/prisma/migrations/20240610182251_initial/migration.sql b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/prisma/migrations/20240610182251_initial/migration.sql new file mode 100644 index 0000000000000000000000000000000000000000..06754f757b63109c48e277b114a342af065379ee --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/prisma/migrations/20240610182251_initial/migration.sql @@ -0,0 +1,70 @@ +-- CreateTable +CREATE TABLE "OAuthInstallation" ( + "id" SERIAL NOT NULL, + "teamId" TEXT, + "enterpriseId" TEXT, + "installation" JSONB NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "OAuthInstallation_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "WorkspaceSettings" ( + "id" SERIAL NOT NULL, + "teamId" TEXT, + "enterpriseId" TEXT, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "WorkspaceSettings_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "ChannelSettings" ( + "id" SERIAL NOT NULL, + "channelId" TEXT NOT NULL, + "workspaceId" INTEGER NOT NULL, + "modelName" TEXT, + "temperature" DOUBLE PRECISION, + "preamble" TEXT, + "tools" TEXT[] DEFAULT ARRAY[]::TEXT[], + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "ChannelSettings_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "OAuthInstallation_teamId_key" ON "OAuthInstallation"("teamId"); + +-- CreateIndex +CREATE UNIQUE INDEX "OAuthInstallation_enterpriseId_key" ON "OAuthInstallation"("enterpriseId"); + +-- CreateIndex +CREATE INDEX "OAuthInstallation_teamId_idx" ON "OAuthInstallation"("teamId"); + +-- CreateIndex +CREATE INDEX "OAuthInstallation_enterpriseId_idx" ON "OAuthInstallation"("enterpriseId"); + +-- CreateIndex +CREATE UNIQUE INDEX "WorkspaceSettings_teamId_key" ON "WorkspaceSettings"("teamId"); + +-- CreateIndex +CREATE UNIQUE INDEX "WorkspaceSettings_enterpriseId_key" ON "WorkspaceSettings"("enterpriseId"); + +-- CreateIndex +CREATE INDEX "WorkspaceSettings_teamId_idx" ON "WorkspaceSettings"("teamId"); + +-- CreateIndex +CREATE INDEX "WorkspaceSettings_enterpriseId_idx" ON "WorkspaceSettings"("enterpriseId"); + +-- CreateIndex +CREATE INDEX "ChannelSettings_channelId_workspaceId_idx" ON "ChannelSettings"("channelId", "workspaceId"); + +-- CreateIndex +CREATE UNIQUE INDEX "ChannelSettings_channelId_workspaceId_key" ON "ChannelSettings"("channelId", "workspaceId"); + +-- AddForeignKey +ALTER TABLE "ChannelSettings" ADD CONSTRAINT "ChannelSettings_workspaceId_fkey" FOREIGN KEY ("workspaceId") REFERENCES "WorkspaceSettings"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/prisma/migrations/20240627183650_deployment/migration.sql b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/prisma/migrations/20240627183650_deployment/migration.sql new file mode 100644 index 0000000000000000000000000000000000000000..a207af143840876fe96f29abcd3a8ffc0965f878 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/prisma/migrations/20240627183650_deployment/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "ChannelSettings" ADD COLUMN "deployment" TEXT; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/prisma/migrations/migration_lock.toml b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/prisma/migrations/migration_lock.toml new file mode 100644 index 0000000000000000000000000000000000000000..6bf901542a400534f176f1847f0bf0634ecd65c3 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/prisma/migrations/migration_lock.toml @@ -0,0 +1,3 @@ +# Please do not edit this file manually +# It should be added in your version-control system (i.e. Git) +provider = "postgresql" \ No newline at end of file diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/prisma/schema.prisma b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/prisma/schema.prisma new file mode 100644 index 0000000000000000000000000000000000000000..bab795072a87d3d9fd87127508c99a057ffb3451 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/prisma/schema.prisma @@ -0,0 +1,67 @@ +// Prisma schema file +// https://pris.ly/d/prisma-schema + +generator client { + provider = "prisma-client-js" +} + +datasource db { + provider = "postgresql" + url = env("DATABASE_URL") +} + +model OAuthInstallation { + id Int @id @default(autoincrement()) + + // Either teamId or enterpriseId will be set, but not both + // https://slack.dev/bolt-js/concepts#authenticating-oauth + teamId String? @unique + enterpriseId String? @unique + + installation Json + + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + @@index([teamId]) + @@index([enterpriseId]) +} + +model WorkspaceSettings { + id Int @id @default(autoincrement()) + + // Either teamId or enterpriseId will be set, but not both + // https://slack.dev/bolt-js/concepts#authenticating-oauth + teamId String? @unique + enterpriseId String? @unique + channelSettings ChannelSettings[] + + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + @@index([teamId]) + @@index([enterpriseId]) +} + +model ChannelSettings { + id Int @id @default(autoincrement()) + + // Channel IDs are unique within a workspace, but not across workspaces. + // Therefore we need to use the combination of channelId and + // workplaceId to uniquely identify a channel. + channelId String + workspace WorkspaceSettings @relation(fields: [workspaceId], references: [id]) + workspaceId Int + + modelName String? + deployment String? + temperature Float? + preamble String? + tools String[] @default([]) + + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + @@unique([channelId, workspaceId], name: "channelSettingsId") + @@index([channelId, workspaceId]) +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/scripts/patchVitestReport.mjs b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/scripts/patchVitestReport.mjs new file mode 100644 index 0000000000000000000000000000000000000000..991b98ae507a88302cbf54634cbb14659b73de62 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/scripts/patchVitestReport.mjs @@ -0,0 +1,21 @@ +// The ArtiomTr/jest-coverage-report-action GitHub action requires that Vitest's JSON coverage report +// is structured like Jest's, where the `coverageMap` value is the data from Vitest's `coverage-final.json`. +// This script patches the report to match the expected structure. +// See https://github.com/ArtiomTr/jest-coverage-report-action/issues/244#issuecomment-1260555231 +import fs from 'node:fs/promises'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const testReportFilename = path.join(__dirname, '..', 'coverage', 'report.json'); +const coverageReportFilename = path.join(__dirname, '..', 'coverage', 'coverage-final.json'); + +const testReport = JSON.parse(await fs.readFile(testReportFilename, 'utf8')); +const coverageReport = JSON.parse(await fs.readFile(coverageReportFilename, 'utf8')); + +testReport.coverageMap = coverageReport; + +await fs.writeFile(testReportFilename, JSON.stringify(testReport)); +console.log('Coverage report appended to ' + testReportFilename); diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/ToolkitClient.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/ToolkitClient.ts new file mode 100644 index 0000000000000000000000000000000000000000..9107ec5e87dc5135430955aa5641c959cf970c42 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/ToolkitClient.ts @@ -0,0 +1,36 @@ +import { AxiosHttpRequest } from './core/AxiosHttpRequest'; +import type { BaseHttpRequest } from './core/BaseHttpRequest'; +import type { OpenAPIConfig } from './core/OpenAPI'; +import { Interceptors } from './core/OpenAPI'; +import { DefaultService } from './services.gen'; + +type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest; + +export class ToolkitClient { + public readonly default: DefaultService; + + public readonly request: BaseHttpRequest; + + constructor( + config?: Partial, + HttpRequest: HttpRequestConstructor = AxiosHttpRequest, + ) { + this.request = new HttpRequest({ + BASE: config?.BASE ?? '', + VERSION: config?.VERSION ?? '0.1.0', + WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false, + CREDENTIALS: config?.CREDENTIALS ?? 'include', + TOKEN: config?.TOKEN, + USERNAME: config?.USERNAME, + PASSWORD: config?.PASSWORD, + HEADERS: config?.HEADERS, + ENCODE_PATH: config?.ENCODE_PATH, + interceptors: { + request: config?.interceptors?.request ?? new Interceptors(), + response: config?.interceptors?.response ?? new Interceptors(), + }, + }); + + this.default = new DefaultService(this.request); + } +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/ApiError.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/ApiError.ts new file mode 100644 index 0000000000000000000000000000000000000000..58c228f1fb76e901ecb4974edad47fd210961f2f --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/ApiError.ts @@ -0,0 +1,21 @@ +import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { ApiResult } from './ApiResult'; + +export class ApiError extends Error { + public readonly url: string; + public readonly status: number; + public readonly statusText: string; + public readonly body: unknown; + public readonly request: ApiRequestOptions; + + constructor(request: ApiRequestOptions, response: ApiResult, message: string) { + super(message); + + this.name = 'ApiError'; + this.url = response.url; + this.status = response.status; + this.statusText = response.statusText; + this.body = response.body; + this.request = request; + } +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/ApiRequestOptions.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/ApiRequestOptions.ts new file mode 100644 index 0000000000000000000000000000000000000000..b1c3b285de8bea23a403d7ad4c83a20910c42733 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/ApiRequestOptions.ts @@ -0,0 +1,13 @@ +export type ApiRequestOptions = { + readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH'; + readonly url: string; + readonly path?: Record; + readonly cookies?: Record; + readonly headers?: Record; + readonly query?: Record; + readonly formData?: Record; + readonly body?: any; + readonly mediaType?: string; + readonly responseHeader?: string; + readonly errors?: Record; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/ApiResult.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/ApiResult.ts new file mode 100644 index 0000000000000000000000000000000000000000..3e917795f4fbe2a298f0561e75035efafad161a3 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/ApiResult.ts @@ -0,0 +1,7 @@ +export type ApiResult = { + readonly body: TData; + readonly ok: boolean; + readonly status: number; + readonly statusText: string; + readonly url: string; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/AxiosHttpRequest.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/AxiosHttpRequest.ts new file mode 100644 index 0000000000000000000000000000000000000000..1a80807da0a3ea6ebec0b311b7010a65e8a163da --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/AxiosHttpRequest.ts @@ -0,0 +1,21 @@ +import type { ApiRequestOptions } from './ApiRequestOptions'; +import { BaseHttpRequest } from './BaseHttpRequest'; +import type { CancelablePromise } from './CancelablePromise'; +import type { OpenAPIConfig } from './OpenAPI'; +import { request as __request } from './request'; + +export class AxiosHttpRequest extends BaseHttpRequest { + constructor(config: OpenAPIConfig) { + super(config); + } + + /** + * Request method + * @param options The request options from the service + * @returns CancelablePromise + * @throws ApiError + */ + public override request(options: ApiRequestOptions): CancelablePromise { + return __request(this.config, options); + } +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/BaseHttpRequest.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/BaseHttpRequest.ts new file mode 100644 index 0000000000000000000000000000000000000000..4272a6eda57ed8f78c55184a2a6844199e55ebd5 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/BaseHttpRequest.ts @@ -0,0 +1,9 @@ +import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { CancelablePromise } from './CancelablePromise'; +import type { OpenAPIConfig } from './OpenAPI'; + +export abstract class BaseHttpRequest { + constructor(public readonly config: OpenAPIConfig) {} + + public abstract request(options: ApiRequestOptions): CancelablePromise; +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/CancelablePromise.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/CancelablePromise.ts new file mode 100644 index 0000000000000000000000000000000000000000..94f56c945952a7caa8e15ac3cd18bcdc36353657 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/CancelablePromise.ts @@ -0,0 +1,126 @@ +export class CancelError extends Error { + constructor(message: string) { + super(message); + this.name = 'CancelError'; + } + + public get isCancelled(): boolean { + return true; + } +} + +export interface OnCancel { + readonly isResolved: boolean; + readonly isRejected: boolean; + readonly isCancelled: boolean; + + (cancelHandler: () => void): void; +} + +export class CancelablePromise implements Promise { + private _isResolved: boolean; + private _isRejected: boolean; + private _isCancelled: boolean; + readonly cancelHandlers: (() => void)[]; + readonly promise: Promise; + private _resolve?: (value: T | PromiseLike) => void; + private _reject?: (reason?: unknown) => void; + + constructor( + executor: ( + resolve: (value: T | PromiseLike) => void, + reject: (reason?: unknown) => void, + onCancel: OnCancel, + ) => void, + ) { + this._isResolved = false; + this._isRejected = false; + this._isCancelled = false; + this.cancelHandlers = []; + this.promise = new Promise((resolve, reject) => { + this._resolve = resolve; + this._reject = reject; + + const onResolve = (value: T | PromiseLike): void => { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this._isResolved = true; + if (this._resolve) this._resolve(value); + }; + + const onReject = (reason?: unknown): void => { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this._isRejected = true; + if (this._reject) this._reject(reason); + }; + + const onCancel = (cancelHandler: () => void): void => { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this.cancelHandlers.push(cancelHandler); + }; + + Object.defineProperty(onCancel, 'isResolved', { + get: (): boolean => this._isResolved, + }); + + Object.defineProperty(onCancel, 'isRejected', { + get: (): boolean => this._isRejected, + }); + + Object.defineProperty(onCancel, 'isCancelled', { + get: (): boolean => this._isCancelled, + }); + + return executor(onResolve, onReject, onCancel as OnCancel); + }); + } + + get [Symbol.toStringTag]() { + return 'Cancellable Promise'; + } + + public then( + onFulfilled?: ((value: T) => TResult1 | PromiseLike) | null, + onRejected?: ((reason: unknown) => TResult2 | PromiseLike) | null, + ): Promise { + return this.promise.then(onFulfilled, onRejected); + } + + public catch( + onRejected?: ((reason: unknown) => TResult | PromiseLike) | null, + ): Promise { + return this.promise.catch(onRejected); + } + + public finally(onFinally?: (() => void) | null): Promise { + return this.promise.finally(onFinally); + } + + public cancel(): void { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this._isCancelled = true; + if (this.cancelHandlers.length) { + try { + for (const cancelHandler of this.cancelHandlers) { + cancelHandler(); + } + } catch (error) { + console.warn('Cancellation threw an error', error); + return; + } + } + this.cancelHandlers.length = 0; + if (this._reject) this._reject(new CancelError('Request aborted')); + } + + public get isCancelled(): boolean { + return this._isCancelled; + } +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/OpenAPI.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/OpenAPI.ts new file mode 100644 index 0000000000000000000000000000000000000000..ecc953ec8d67f7bc3eac75be1366af395c534a41 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/OpenAPI.ts @@ -0,0 +1,58 @@ +import type { AxiosRequestConfig, AxiosResponse } from 'axios'; + +import type { ApiRequestOptions } from './ApiRequestOptions'; + +type Headers = Record; +type Middleware = (value: T) => T | Promise; +type Resolver = (options: ApiRequestOptions) => Promise; + +export class Interceptors { + _fns: Middleware[]; + + constructor() { + this._fns = []; + } + + eject(fn: Middleware) { + const index = this._fns.indexOf(fn); + if (index !== -1) { + this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)]; + } + } + + use(fn: Middleware) { + this._fns = [...this._fns, fn]; + } +} + +export type OpenAPIConfig = { + BASE: string; + CREDENTIALS: 'include' | 'omit' | 'same-origin'; + ENCODE_PATH?: ((path: string) => string) | undefined; + HEADERS?: Headers | Resolver | undefined; + PASSWORD?: string | Resolver | undefined; + TOKEN?: string | Resolver | undefined; + USERNAME?: string | Resolver | undefined; + VERSION: string; + WITH_CREDENTIALS: boolean; + interceptors: { + request: Interceptors; + response: Interceptors; + }; +}; + +export const OpenAPI: OpenAPIConfig = { + BASE: 'http://0.0.0.0:8000', + CREDENTIALS: 'include', + ENCODE_PATH: undefined, + HEADERS: undefined, + PASSWORD: undefined, + TOKEN: undefined, + USERNAME: undefined, + VERSION: '0.1.0', + WITH_CREDENTIALS: false, + interceptors: { + request: new Interceptors(), + response: new Interceptors(), + }, +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/request.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/request.ts new file mode 100644 index 0000000000000000000000000000000000000000..df358df227c9ccd18bdaa5210ddb13d58d834f04 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/core/request.ts @@ -0,0 +1,365 @@ +import axios from 'axios'; +import type { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'; + +import { ApiError } from './ApiError'; +import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { ApiResult } from './ApiResult'; +import { CancelablePromise } from './CancelablePromise'; +import type { OnCancel } from './CancelablePromise'; +import type { OpenAPIConfig } from './OpenAPI'; + +export const isString = (value: unknown): value is string => { + return typeof value === 'string'; +}; + +export const isStringWithValue = (value: unknown): value is string => { + return isString(value) && value !== ''; +}; + +export const isBlob = (value: any): value is Blob => { + return value instanceof Blob; +}; + +export const isFormData = (value: unknown): value is FormData => { + return value instanceof FormData; +}; + +export const isSuccess = (status: number): boolean => { + return status >= 200 && status < 300; +}; + +export const base64 = (str: string): string => { + try { + return btoa(str); + } catch (err) { + // @ts-ignore + return Buffer.from(str).toString('base64'); + } +}; + +export const getQueryString = (params: Record): string => { + const qs: string[] = []; + + const append = (key: string, value: unknown) => { + qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`); + }; + + const encodePair = (key: string, value: unknown) => { + if (value === undefined || value === null) { + return; + } + + if (value instanceof Date) { + append(key, value.toISOString()); + } else if (Array.isArray(value)) { + value.forEach((v) => encodePair(key, v)); + } else if (typeof value === 'object') { + Object.entries(value).forEach(([k, v]) => encodePair(`${key}[${k}]`, v)); + } else { + append(key, value); + } + }; + + Object.entries(params).forEach(([key, value]) => encodePair(key, value)); + + return qs.length ? `?${qs.join('&')}` : ''; +}; + +const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => { + const encoder = config.ENCODE_PATH || encodeURI; + + const path = options.url + .replace('{api-version}', config.VERSION) + .replace(/{(.*?)}/g, (substring: string, group: string) => { + if (options.path?.hasOwnProperty(group)) { + return encoder(String(options.path[group])); + } + return substring; + }); + + const url = config.BASE + path; + return options.query ? url + getQueryString(options.query) : url; +}; + +export const getFormData = (options: ApiRequestOptions): FormData | undefined => { + if (options.formData) { + const formData = new FormData(); + + const process = (key: string, value: unknown) => { + if (isString(value) || isBlob(value)) { + formData.append(key, value); + } else { + formData.append(key, JSON.stringify(value)); + } + }; + + Object.entries(options.formData) + .filter(([, value]) => value !== undefined && value !== null) + .forEach(([key, value]) => { + if (Array.isArray(value)) { + value.forEach((v) => process(key, v)); + } else { + process(key, value); + } + }); + + return formData; + } + return undefined; +}; + +type Resolver = (options: ApiRequestOptions) => Promise; + +export const resolve = async ( + options: ApiRequestOptions, + resolver?: T | Resolver, +): Promise => { + if (typeof resolver === 'function') { + return (resolver as Resolver)(options); + } + return resolver; +}; + +export const getHeaders = async ( + config: OpenAPIConfig, + options: ApiRequestOptions, +): Promise> => { + const [token, username, password, additionalHeaders] = await Promise.all([ + resolve(options, config.TOKEN), + resolve(options, config.USERNAME), + resolve(options, config.PASSWORD), + resolve(options, config.HEADERS), + ]); + + const headers = Object.entries({ + Accept: 'application/json', + ...additionalHeaders, + ...options.headers, + }) + .filter(([, value]) => value !== undefined && value !== null) + .reduce( + (headers, [key, value]) => ({ + ...headers, + [key]: String(value), + }), + {} as Record, + ); + + if (isStringWithValue(token)) { + headers['Authorization'] = `Bearer ${token}`; + } + + if (isStringWithValue(username) && isStringWithValue(password)) { + const credentials = base64(`${username}:${password}`); + headers['Authorization'] = `Basic ${credentials}`; + } + + if (options.body !== undefined) { + if (options.mediaType) { + headers['Content-Type'] = options.mediaType; + } else if (isBlob(options.body)) { + headers['Content-Type'] = options.body.type || 'application/octet-stream'; + } else if (isString(options.body)) { + headers['Content-Type'] = 'text/plain'; + } else if (!isFormData(options.body)) { + headers['Content-Type'] = 'application/json'; + } + } else if (options.formData !== undefined) { + if (options.mediaType) { + headers['Content-Type'] = options.mediaType; + } + } + + return headers; +}; + +export const getRequestBody = (options: ApiRequestOptions): unknown => { + if (options.body) { + return options.body; + } + return undefined; +}; + +export const sendRequest = async ( + config: OpenAPIConfig, + options: ApiRequestOptions, + url: string, + body: unknown, + formData: FormData | undefined, + headers: Record, + onCancel: OnCancel, + axiosClient: AxiosInstance, +): Promise> => { + const controller = new AbortController(); + + let requestConfig: AxiosRequestConfig = { + data: body ?? formData, + headers, + method: options.method, + signal: controller.signal, + url, + withCredentials: config.WITH_CREDENTIALS, + }; + + onCancel(() => controller.abort()); + + for (const fn of config.interceptors.request._fns) { + requestConfig = await fn(requestConfig); + } + + try { + return await axiosClient.request(requestConfig); + } catch (error) { + const axiosError = error as AxiosError; + if (axiosError.response) { + return axiosError.response; + } + throw error; + } +}; + +export const getResponseHeader = ( + response: AxiosResponse, + responseHeader?: string, +): string | undefined => { + if (responseHeader) { + const content = response.headers[responseHeader]; + if (isString(content)) { + return content; + } + } + return undefined; +}; + +export const getResponseBody = (response: AxiosResponse): unknown => { + if (response.status !== 204) { + return response.data; + } + return undefined; +}; + +export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => { + const errors: Record = { + 400: 'Bad Request', + 401: 'Unauthorized', + 402: 'Payment Required', + 403: 'Forbidden', + 404: 'Not Found', + 405: 'Method Not Allowed', + 406: 'Not Acceptable', + 407: 'Proxy Authentication Required', + 408: 'Request Timeout', + 409: 'Conflict', + 410: 'Gone', + 411: 'Length Required', + 412: 'Precondition Failed', + 413: 'Payload Too Large', + 414: 'URI Too Long', + 415: 'Unsupported Media Type', + 416: 'Range Not Satisfiable', + 417: 'Expectation Failed', + 418: 'Im a teapot', + 421: 'Misdirected Request', + 422: 'Unprocessable Content', + 423: 'Locked', + 424: 'Failed Dependency', + 425: 'Too Early', + 426: 'Upgrade Required', + 428: 'Precondition Required', + 429: 'Too Many Requests', + 431: 'Request Header Fields Too Large', + 451: 'Unavailable For Legal Reasons', + 500: 'Internal Server Error', + 501: 'Not Implemented', + 502: 'Bad Gateway', + 503: 'Service Unavailable', + 504: 'Gateway Timeout', + 505: 'HTTP Version Not Supported', + 506: 'Variant Also Negotiates', + 507: 'Insufficient Storage', + 508: 'Loop Detected', + 510: 'Not Extended', + 511: 'Network Authentication Required', + ...options.errors, + }; + + const error = errors[result.status]; + if (error) { + throw new ApiError(options, result, error); + } + + if (!result.ok) { + const errorStatus = result.status ?? 'unknown'; + const errorStatusText = result.statusText ?? 'unknown'; + const errorBody = (() => { + try { + return JSON.stringify(result.body, null, 2); + } catch (e) { + return undefined; + } + })(); + + throw new ApiError( + options, + result, + `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`, + ); + } +}; + +/** + * Request method + * @param config The OpenAPI configuration object + * @param options The request options from the service + * @param axiosClient The axios client instance to use + * @returns CancelablePromise + * @throws ApiError + */ +export const request = ( + config: OpenAPIConfig, + options: ApiRequestOptions, + axiosClient: AxiosInstance = axios, +): CancelablePromise => { + return new CancelablePromise(async (resolve, reject, onCancel) => { + try { + const url = getUrl(config, options); + const formData = getFormData(options); + const body = getRequestBody(options); + const headers = await getHeaders(config, options); + + if (!onCancel.isCancelled) { + let response = await sendRequest( + config, + options, + url, + body, + formData, + headers, + onCancel, + axiosClient, + ); + + for (const fn of config.interceptors.response._fns) { + response = await fn(response); + } + + const responseBody = getResponseBody(response); + const responseHeader = getResponseHeader(response, options.responseHeader); + + const result: ApiResult = { + url, + ok: isSuccess(response.status), + status: response.status, + statusText: response.statusText, + body: responseHeader ?? responseBody, + }; + + catchErrorCodes(options, result); + + resolve(result.body); + } + } catch (error) { + reject(error); + } + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/index.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..05068b88356920c30f639e9edebd8be1531712ee --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/index.ts @@ -0,0 +1,9 @@ +// This file is auto-generated by @hey-api/openapi-ts +export { ToolkitClient } from './ToolkitClient'; +export { ApiError } from './core/ApiError'; +export { BaseHttpRequest } from './core/BaseHttpRequest'; +export { CancelablePromise, CancelError } from './core/CancelablePromise'; +export { OpenAPI, type OpenAPIConfig } from './core/OpenAPI'; +export * from './schemas.gen'; +export * from './services.gen'; +export * from './types.gen'; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/schemas.gen.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/schemas.gen.ts new file mode 100644 index 0000000000000000000000000000000000000000..ab0459de46edff5d1f5e0ae190433fa8688e750d --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/schemas.gen.ts @@ -0,0 +1,2916 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export const $Agent = { + properties: { + user_id: { + type: 'string', + title: 'User Id', + }, + organization_id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Organization Id', + }, + id: { + type: 'string', + title: 'Id', + }, + created_at: { + type: 'string', + format: 'date-time', + title: 'Created At', + }, + updated_at: { + type: 'string', + format: 'date-time', + title: 'Updated At', + }, + version: { + type: 'integer', + title: 'Version', + }, + name: { + type: 'string', + title: 'Name', + }, + description: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Description', + }, + preamble: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Preamble', + }, + temperature: { + type: 'number', + title: 'Temperature', + }, + tools: { + items: { + type: 'string', + }, + type: 'array', + title: 'Tools', + }, + tools_metadata: { + items: { + $ref: '#/components/schemas/AgentToolMetadata', + }, + type: 'array', + title: 'Tools Metadata', + }, + model: { + type: 'string', + title: 'Model', + }, + deployment: { + type: 'string', + title: 'Deployment', + }, + }, + type: 'object', + required: [ + 'user_id', + 'id', + 'created_at', + 'updated_at', + 'version', + 'name', + 'description', + 'preamble', + 'temperature', + 'tools', + 'tools_metadata', + 'model', + 'deployment', + ], + title: 'Agent', +} as const; + +export const $AgentToolMetadata = { + properties: { + user_id: { + type: 'string', + title: 'User Id', + }, + organization_id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Organization Id', + }, + id: { + type: 'string', + title: 'Id', + }, + tool_name: { + type: 'string', + title: 'Tool Name', + }, + artifacts: { + items: { + type: 'object', + }, + type: 'array', + title: 'Artifacts', + }, + }, + type: 'object', + required: ['user_id', 'id', 'tool_name', 'artifacts'], + title: 'AgentToolMetadata', +} as const; + +export const $Body_upload_file_v1_conversations_upload_file_post = { + properties: { + conversation_id: { + type: 'string', + title: 'Conversation Id', + }, + file: { + type: 'string', + format: 'binary', + title: 'File', + }, + }, + type: 'object', + required: ['file'], + title: 'Body_upload_file_v1_conversations_upload_file_post', +} as const; + +export const $Category = { + type: 'string', + enum: ['File loader', 'Data loader', 'Function'], + title: 'Category', +} as const; + +export const $ChatMessage = { + properties: { + role: { + allOf: [ + { + $ref: '#/components/schemas/ChatRole', + }, + ], + title: 'One of CHATBOT|USER|SYSTEM to identify who the message is coming from.', + }, + message: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Contents of the chat message.', + }, + tool_plan: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Contents of the tool plan.', + }, + tool_results: { + anyOf: [ + { + items: { + type: 'object', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: 'Results from the tool call.', + }, + tool_calls: { + anyOf: [ + { + items: { + type: 'object', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: 'List of tool calls generated for custom tools', + }, + }, + type: 'object', + required: ['role'], + title: 'ChatMessage', + description: + "A list of previous messages between the user and the model, meant to give the model conversational context for responding to the user's message.", +} as const; + +export const $ChatResponseEvent = { + properties: { + event: { + allOf: [ + { + $ref: '#/components/schemas/StreamEvent', + }, + ], + title: 'type of stream event', + }, + data: { + anyOf: [ + { + $ref: '#/components/schemas/StreamStart', + }, + { + $ref: '#/components/schemas/StreamTextGeneration', + }, + { + $ref: '#/components/schemas/StreamCitationGeneration', + }, + { + $ref: '#/components/schemas/StreamQueryGeneration', + }, + { + $ref: '#/components/schemas/StreamSearchResults', + }, + { + $ref: '#/components/schemas/StreamEnd', + }, + { + $ref: '#/components/schemas/StreamToolInput', + }, + { + $ref: '#/components/schemas/StreamToolResult', + }, + { + $ref: '#/components/schemas/StreamSearchQueriesGeneration', + }, + { + $ref: '#/components/schemas/StreamToolCallsGeneration', + }, + { + $ref: '#/components/schemas/StreamToolCallsChunk', + }, + { + $ref: '#/components/schemas/NonStreamedChatResponse', + }, + ], + title: 'Data returned from chat response of a given event type', + }, + }, + type: 'object', + required: ['event', 'data'], + title: 'ChatResponseEvent', +} as const; + +export const $ChatRole = { + type: 'string', + enum: ['CHATBOT', 'USER', 'SYSTEM', 'TOOL'], + title: 'ChatRole', + description: 'One of CHATBOT|USER|SYSTEM to identify who the message is coming from.', +} as const; + +export const $Citation = { + properties: { + text: { + type: 'string', + title: 'Text', + }, + start: { + type: 'integer', + title: 'Start', + }, + end: { + type: 'integer', + title: 'End', + }, + document_ids: { + items: { + type: 'string', + }, + type: 'array', + title: 'Document Ids', + }, + }, + type: 'object', + required: ['text', 'start', 'end', 'document_ids'], + title: 'Citation', +} as const; + +export const $CohereChatPromptTruncation = { + type: 'string', + enum: ['OFF', 'AUTO_PRESERVE_ORDER'], + title: 'CohereChatPromptTruncation', + description: 'Dictates how the prompt will be constructed. Defaults to "AUTO_PRESERVE_ORDER".', +} as const; + +export const $CohereChatRequest = { + properties: { + message: { + type: 'string', + title: 'The message to send to the chatbot.', + }, + chat_history: { + anyOf: [ + { + items: { + $ref: '#/components/schemas/ChatMessage', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: + 'A list of entries used to construct the conversation. If provided, these messages will be used to build the prompt and the conversation_id will be ignored so no data will be stored to maintain state.', + }, + conversation_id: { + type: 'string', + title: + 'To store a conversation then create a conversation id and use it for every related request', + }, + tools: { + anyOf: [ + { + items: { + $ref: '#/components/schemas/Tool', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: ` + List of custom or managed tools to use for the response. + If passing in managed tools, you only need to provide the name of the tool. + If passing in custom tools, you need to provide the name, description, and optionally parameter defintions of the tool. + Passing a mix of custom and managed tools is not supported. + + Managed Tools Examples: + tools=[ + { + "name": "Wiki Retriever - LangChain", + }, + { + "name": "Calculator", + } + ] + + Custom Tools Examples: + tools=[ + { + "name": "movie_title_generator", + "description": "tool to generate a cool movie title", + "parameter_definitions": { + "synopsis": { + "description": "short synopsis of the movie", + "type": "str", + "required": true + } + } + }, + { + "name": "random_number_generator", + "description": "tool to generate a random number between min and max", + "parameter_definitions": { + "min": { + "description": "minimum number", + "type": "int", + "required": true + }, + "max": { + "description": "maximum number", + "type": "int", + "required": true + } + } + }, + { + "name": "joke_generator", + "description": "tool to generate a random joke", + } + ] + `, + }, + documents: { + items: { + type: 'object', + }, + type: 'array', + title: `Documents to use to generate grounded response with citations. Example: + documents=[ + { + "id": "national_geographic_everest", + "title": "Height of Mount Everest", + "text": "The height of Mount Everest is 29,035 feet", + "url": "https://education.nationalgeographic.org/resource/mount-everest/", + }, + { + "id": "national_geographic_mariana", + "title": "Depth of the Mariana Trench", + "text": "The depth of the Mariana Trench is 36,070 feet", + "url": "https://www.nationalgeographic.org/activity/mariana-trench-deepest-place-earth", + }, + ] + `, + }, + model: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'The model to use for generating the response.', + default: 'command-r', + }, + temperature: { + anyOf: [ + { + type: 'number', + minimum: 0, + }, + { + type: 'null', + }, + ], + title: + 'A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations, and higher temperatures mean more random generations.', + }, + k: { + anyOf: [ + { + type: 'integer', + maximum: 500, + minimum: 0, + }, + { + type: 'null', + }, + ], + title: + 'Ensures only the top k most likely tokens are considered for generation at each step.', + }, + p: { + anyOf: [ + { + type: 'number', + maximum: 0.99, + minimum: 0, + }, + { + type: 'null', + }, + ], + title: + 'Ensures that only the most likely tokens, with total probability mass of p, are considered for generation at each step. If both k and p are enabled, p acts after k.', + }, + preamble: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'A string to override the preamble.', + }, + file_ids: { + anyOf: [ + { + items: { + type: 'string', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: 'List of File IDs for PDFs used in RAG for the response.', + }, + search_queries_only: { + anyOf: [ + { + type: 'boolean', + }, + { + type: 'null', + }, + ], + title: + "When set to true a list of search queries are generated. No search will occur nor replies to the user's message.", + default: false, + }, + max_tokens: { + anyOf: [ + { + type: 'integer', + minimum: 1, + }, + { + type: 'null', + }, + ], + title: + 'The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations.', + }, + seed: { + anyOf: [ + { + type: 'number', + }, + { + type: 'null', + }, + ], + title: + 'If specified, the backend will make a best effort to sample tokens deterministically, such that repeated requests with the same seed and parameters should return the same result. However, determinism cannot be totally guaranteed.', + }, + stop_sequences: { + anyOf: [ + { + items: { + type: 'string', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: + 'A list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence.', + }, + presence_penalty: { + anyOf: [ + { + type: 'number', + maximum: 1, + minimum: 0, + }, + { + type: 'null', + }, + ], + title: + 'Used to reduce repetitiveness of generated tokens. Similar to frequency_penalty, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.', + }, + frequency_penalty: { + anyOf: [ + { + type: 'number', + maximum: 1, + minimum: 0, + }, + { + type: 'null', + }, + ], + title: + 'Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation.', + }, + prompt_truncation: { + allOf: [ + { + $ref: '#/components/schemas/CohereChatPromptTruncation', + }, + ], + title: "Dictates how the prompt will be constructed. Defaults to 'AUTO_PRESERVE_ORDER'.", + default: 'AUTO_PRESERVE_ORDER', + }, + tool_results: { + anyOf: [ + { + items: { + type: 'object', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: + 'A list of results from invoking tools recommended by the model in the previous chat turn. Results are used to produce a text response and will be referenced in citations.', + }, + force_single_step: { + anyOf: [ + { + type: 'boolean', + }, + { + type: 'null', + }, + ], + title: + 'If set to true, the model will generate a single response in a single step. This is useful for generating a response to a single message.', + }, + }, + type: 'object', + required: ['message'], + title: 'CohereChatRequest', + description: `Request shape for Cohere Python SDK Streamed Chat. +See: https://github.com/cohere-ai/cohere-python/blob/main/src/cohere/base_client.py#L1629`, +} as const; + +export const $Conversation = { + properties: { + user_id: { + type: 'string', + title: 'User Id', + }, + organization_id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Organization Id', + }, + id: { + type: 'string', + title: 'Id', + }, + created_at: { + type: 'string', + format: 'date-time', + title: 'Created At', + }, + updated_at: { + type: 'string', + format: 'date-time', + title: 'Updated At', + }, + title: { + type: 'string', + title: 'Title', + }, + messages: { + items: { + $ref: '#/components/schemas/Message', + }, + type: 'array', + title: 'Messages', + }, + files: { + items: { + $ref: '#/components/schemas/File', + }, + type: 'array', + title: 'Files', + }, + description: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Description', + }, + agent_id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Agent Id', + }, + total_file_size: { + type: 'integer', + title: 'Total File Size', + readOnly: true, + }, + }, + type: 'object', + required: [ + 'user_id', + 'id', + 'created_at', + 'updated_at', + 'title', + 'messages', + 'files', + 'description', + 'agent_id', + 'total_file_size', + ], + title: 'Conversation', +} as const; + +export const $ConversationWithoutMessages = { + properties: { + user_id: { + type: 'string', + title: 'User Id', + }, + organization_id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Organization Id', + }, + id: { + type: 'string', + title: 'Id', + }, + created_at: { + type: 'string', + format: 'date-time', + title: 'Created At', + }, + updated_at: { + type: 'string', + format: 'date-time', + title: 'Updated At', + }, + title: { + type: 'string', + title: 'Title', + }, + files: { + items: { + $ref: '#/components/schemas/File', + }, + type: 'array', + title: 'Files', + }, + description: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Description', + }, + agent_id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Agent Id', + }, + total_file_size: { + type: 'integer', + title: 'Total File Size', + readOnly: true, + }, + }, + type: 'object', + required: [ + 'user_id', + 'id', + 'created_at', + 'updated_at', + 'title', + 'files', + 'description', + 'agent_id', + 'total_file_size', + ], + title: 'ConversationWithoutMessages', +} as const; + +export const $CreateAgent = { + properties: { + name: { + type: 'string', + title: 'Name', + }, + version: { + anyOf: [ + { + type: 'integer', + }, + { + type: 'null', + }, + ], + title: 'Version', + }, + description: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Description', + }, + preamble: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Preamble', + }, + temperature: { + anyOf: [ + { + type: 'number', + }, + { + type: 'null', + }, + ], + title: 'Temperature', + }, + model: { + type: 'string', + title: 'Model', + }, + deployment: { + type: 'string', + title: 'Deployment', + }, + tools: { + anyOf: [ + { + items: { + type: 'string', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: 'Tools', + }, + tools_metadata: { + anyOf: [ + { + items: { + $ref: '#/components/schemas/CreateAgentToolMetadata', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: 'Tools Metadata', + }, + }, + type: 'object', + required: ['name', 'model', 'deployment'], + title: 'CreateAgent', +} as const; + +export const $CreateAgentToolMetadata = { + properties: { + tool_name: { + type: 'string', + title: 'Tool Name', + }, + artifacts: { + items: { + type: 'object', + }, + type: 'array', + title: 'Artifacts', + }, + }, + type: 'object', + required: ['tool_name', 'artifacts'], + title: 'CreateAgentToolMetadata', +} as const; + +export const $CreateSnapshot = { + properties: { + conversation_id: { + type: 'string', + title: 'Conversation Id', + }, + }, + type: 'object', + required: ['conversation_id'], + title: 'CreateSnapshot', +} as const; + +export const $CreateSnapshotResponse = { + properties: { + snapshot_id: { + type: 'string', + title: 'Snapshot Id', + }, + user_id: { + type: 'string', + title: 'User Id', + }, + link_id: { + type: 'string', + title: 'Link Id', + }, + messages: { + items: { + $ref: '#/components/schemas/Message', + }, + type: 'array', + title: 'Messages', + }, + }, + type: 'object', + required: ['snapshot_id', 'user_id', 'link_id', 'messages'], + title: 'CreateSnapshotResponse', +} as const; + +export const $CreateUser = { + properties: { + password: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Password', + }, + hashed_password: { + anyOf: [ + { + type: 'string', + format: 'binary', + }, + { + type: 'null', + }, + ], + title: 'Hashed Password', + }, + fullname: { + type: 'string', + title: 'Fullname', + }, + email: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Email', + }, + }, + type: 'object', + required: ['fullname'], + title: 'CreateUser', +} as const; + +export const $DeleteAgent = { + properties: {}, + type: 'object', + title: 'DeleteAgent', +} as const; + +export const $DeleteAgentToolMetadata = { + properties: {}, + type: 'object', + title: 'DeleteAgentToolMetadata', +} as const; + +export const $DeleteConversation = { + properties: {}, + type: 'object', + title: 'DeleteConversation', +} as const; + +export const $DeleteFile = { + properties: {}, + type: 'object', + title: 'DeleteFile', +} as const; + +export const $DeleteUser = { + properties: {}, + type: 'object', + title: 'DeleteUser', +} as const; + +export const $Deployment = { + properties: { + name: { + type: 'string', + title: 'Name', + }, + models: { + items: { + type: 'string', + }, + type: 'array', + title: 'Models', + }, + is_available: { + type: 'boolean', + title: 'Is Available', + }, + env_vars: { + items: { + type: 'string', + }, + type: 'array', + title: 'Env Vars', + }, + }, + type: 'object', + required: ['name', 'models', 'is_available', 'env_vars'], + title: 'Deployment', +} as const; + +export const $Document = { + properties: { + text: { + type: 'string', + title: 'Text', + }, + document_id: { + type: 'string', + title: 'Document Id', + }, + title: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Title', + }, + url: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Url', + }, + fields: { + anyOf: [ + { + type: 'object', + }, + { + type: 'null', + }, + ], + title: 'Fields', + }, + tool_name: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Tool Name', + }, + }, + type: 'object', + required: ['text', 'document_id', 'title', 'url', 'fields', 'tool_name'], + title: 'Document', +} as const; + +export const $File = { + properties: { + id: { + type: 'string', + title: 'Id', + }, + created_at: { + type: 'string', + format: 'date-time', + title: 'Created At', + }, + updated_at: { + type: 'string', + format: 'date-time', + title: 'Updated At', + }, + user_id: { + type: 'string', + title: 'User Id', + }, + conversation_id: { + type: 'string', + title: 'Conversation Id', + }, + file_name: { + type: 'string', + title: 'File Name', + }, + file_path: { + type: 'string', + title: 'File Path', + }, + file_size: { + type: 'integer', + minimum: 0, + title: 'File Size', + default: 0, + }, + }, + type: 'object', + required: [ + 'id', + 'created_at', + 'updated_at', + 'user_id', + 'conversation_id', + 'file_name', + 'file_path', + ], + title: 'File', +} as const; + +export const $GenerateTitle = { + properties: { + title: { + type: 'string', + title: 'Title', + }, + }, + type: 'object', + required: ['title'], + title: 'GenerateTitle', +} as const; + +export const $HTTPValidationError = { + properties: { + detail: { + items: { + $ref: '#/components/schemas/ValidationError', + }, + type: 'array', + title: 'Detail', + }, + }, + type: 'object', + title: 'HTTPValidationError', +} as const; + +export const $JWTResponse = { + properties: { + token: { + type: 'string', + title: 'Token', + }, + }, + type: 'object', + required: ['token'], + title: 'JWTResponse', +} as const; + +export const $LangchainChatRequest = { + properties: { + message: { + type: 'string', + title: 'The message to send to the chatbot.', + }, + chat_history: { + anyOf: [ + { + items: { + $ref: '#/components/schemas/ChatMessage', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: + 'A list of entries used to construct the conversation. If provided, these messages will be used to build the prompt and the conversation_id will be ignored so no data will be stored to maintain state.', + }, + conversation_id: { + type: 'string', + title: + 'To store a conversation then create a conversation id and use it for every related request', + }, + tools: { + anyOf: [ + { + items: { + $ref: '#/components/schemas/Tool', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: ` + List of custom or managed tools to use for the response. + If passing in managed tools, you only need to provide the name of the tool. + If passing in custom tools, you need to provide the name, description, and optionally parameter defintions of the tool. + Passing a mix of custom and managed tools is not supported. + + Managed Tools Examples: + tools=[ + { + "name": "Wiki Retriever - LangChain", + }, + { + "name": "Calculator", + } + ] + + Custom Tools Examples: + tools=[ + { + "name": "movie_title_generator", + "description": "tool to generate a cool movie title", + "parameter_definitions": { + "synopsis": { + "description": "short synopsis of the movie", + "type": "str", + "required": true + } + } + }, + { + "name": "random_number_generator", + "description": "tool to generate a random number between min and max", + "parameter_definitions": { + "min": { + "description": "minimum number", + "type": "int", + "required": true + }, + "max": { + "description": "maximum number", + "type": "int", + "required": true + } + } + }, + { + "name": "joke_generator", + "description": "tool to generate a random joke", + } + ] + `, + }, + }, + type: 'object', + required: ['message'], + title: 'LangchainChatRequest', + description: 'Request shape for Langchain Streamed Chat.', +} as const; + +export const $ListAuthStrategy = { + properties: { + strategy: { + type: 'string', + title: 'Strategy', + }, + client_id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Client Id', + }, + authorization_endpoint: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Authorization Endpoint', + }, + pkce_enabled: { + type: 'boolean', + title: 'Pkce Enabled', + }, + }, + type: 'object', + required: ['strategy', 'client_id', 'authorization_endpoint', 'pkce_enabled'], + title: 'ListAuthStrategy', +} as const; + +export const $ListFile = { + properties: { + id: { + type: 'string', + title: 'Id', + }, + created_at: { + type: 'string', + format: 'date-time', + title: 'Created At', + }, + updated_at: { + type: 'string', + format: 'date-time', + title: 'Updated At', + }, + user_id: { + type: 'string', + title: 'User Id', + }, + conversation_id: { + type: 'string', + title: 'Conversation Id', + }, + file_name: { + type: 'string', + title: 'File Name', + }, + file_path: { + type: 'string', + title: 'File Path', + }, + file_size: { + type: 'integer', + minimum: 0, + title: 'File Size', + default: 0, + }, + }, + type: 'object', + required: [ + 'id', + 'created_at', + 'updated_at', + 'user_id', + 'conversation_id', + 'file_name', + 'file_path', + ], + title: 'ListFile', +} as const; + +export const $Login = { + properties: { + strategy: { + type: 'string', + title: 'Strategy', + }, + payload: { + anyOf: [ + { + additionalProperties: { + type: 'string', + }, + type: 'object', + }, + { + type: 'null', + }, + ], + title: 'Payload', + }, + }, + type: 'object', + required: ['strategy'], + title: 'Login', +} as const; + +export const $Logout = { + properties: {}, + type: 'object', + title: 'Logout', +} as const; + +export const $ManagedTool = { + properties: { + name: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Name', + default: '', + }, + display_name: { + type: 'string', + title: 'Display Name', + default: '', + }, + description: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Description', + default: '', + }, + parameter_definitions: { + anyOf: [ + { + type: 'object', + }, + { + type: 'null', + }, + ], + title: 'Parameter Definitions', + default: {}, + }, + kwargs: { + type: 'object', + title: 'Kwargs', + default: {}, + }, + is_visible: { + type: 'boolean', + title: 'Is Visible', + default: false, + }, + is_available: { + type: 'boolean', + title: 'Is Available', + default: false, + }, + error_message: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Error Message', + default: '', + }, + category: { + allOf: [ + { + $ref: '#/components/schemas/Category', + }, + ], + default: 'Data loader', + }, + is_auth_required: { + type: 'boolean', + title: 'Is Auth Required', + default: false, + }, + auth_url: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Auth Url', + default: '', + }, + }, + type: 'object', + title: 'ManagedTool', +} as const; + +export const $Message = { + properties: { + text: { + type: 'string', + title: 'Text', + }, + id: { + type: 'string', + title: 'Id', + }, + created_at: { + type: 'string', + format: 'date-time', + title: 'Created At', + }, + updated_at: { + type: 'string', + format: 'date-time', + title: 'Updated At', + }, + generation_id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Generation Id', + }, + position: { + type: 'integer', + title: 'Position', + }, + is_active: { + type: 'boolean', + title: 'Is Active', + }, + documents: { + items: { + $ref: '#/components/schemas/Document', + }, + type: 'array', + title: 'Documents', + }, + citations: { + items: { + $ref: '#/components/schemas/Citation', + }, + type: 'array', + title: 'Citations', + }, + files: { + items: { + $ref: '#/components/schemas/File', + }, + type: 'array', + title: 'Files', + }, + tool_calls: { + items: { + $ref: '#/components/schemas/ToolCall', + }, + type: 'array', + title: 'Tool Calls', + }, + tool_plan: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Tool Plan', + }, + agent: { + $ref: '#/components/schemas/MessageAgent', + }, + }, + type: 'object', + required: [ + 'text', + 'id', + 'created_at', + 'updated_at', + 'generation_id', + 'position', + 'is_active', + 'documents', + 'citations', + 'files', + 'tool_calls', + 'tool_plan', + 'agent', + ], + title: 'Message', +} as const; + +export const $MessageAgent = { + type: 'string', + enum: ['USER', 'CHATBOT'], + title: 'MessageAgent', +} as const; + +export const $NonStreamedChatResponse = { + properties: { + response_id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Unique identifier for the response.', + }, + generation_id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Unique identifier for the generation.', + }, + chat_history: { + anyOf: [ + { + items: { + $ref: '#/components/schemas/ChatMessage', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: + "A list of previous messages between the user and the model, meant to give the model conversational context for responding to the user's message.", + }, + finish_reason: { + type: 'string', + title: 'Reason the chat stream ended.', + }, + text: { + type: 'string', + title: 'Contents of the chat message.', + }, + citations: { + anyOf: [ + { + items: { + $ref: '#/components/schemas/Citation', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: 'Citations for the chat message.', + default: [], + }, + documents: { + anyOf: [ + { + items: { + $ref: '#/components/schemas/Document', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: 'Documents used to generate grounded response with citations.', + default: [], + }, + search_results: { + anyOf: [ + { + items: { + type: 'object', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: 'Search results used to generate grounded response with citations.', + default: [], + }, + search_queries: { + anyOf: [ + { + items: { + $ref: '#/components/schemas/SearchQuery', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: 'List of generated search queries.', + default: [], + }, + conversation_id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: + 'To store a conversation then create a conversation id and use it for every related request.', + }, + tool_calls: { + anyOf: [ + { + items: { + $ref: '#/components/schemas/ToolCall', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: 'List of tool calls generated for custom tools', + default: [], + }, + }, + type: 'object', + required: [ + 'response_id', + 'generation_id', + 'chat_history', + 'finish_reason', + 'text', + 'conversation_id', + ], + title: 'NonStreamedChatResponse', +} as const; + +export const $SearchQuery = { + properties: { + text: { + type: 'string', + title: 'Text', + }, + generation_id: { + type: 'string', + title: 'Generation Id', + }, + }, + type: 'object', + required: ['text', 'generation_id'], + title: 'SearchQuery', +} as const; + +export const $Snapshot = { + properties: { + conversation_id: { + type: 'string', + title: 'Conversation Id', + }, + id: { + type: 'string', + title: 'Id', + }, + last_message_id: { + type: 'string', + title: 'Last Message Id', + }, + user_id: { + type: 'string', + title: 'User Id', + }, + organization_id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Organization Id', + }, + version: { + type: 'integer', + title: 'Version', + }, + created_at: { + type: 'string', + format: 'date-time', + title: 'Created At', + }, + updated_at: { + type: 'string', + format: 'date-time', + title: 'Updated At', + }, + snapshot: { + $ref: '#/components/schemas/SnapshotData', + }, + }, + type: 'object', + required: [ + 'conversation_id', + 'id', + 'last_message_id', + 'user_id', + 'organization_id', + 'version', + 'created_at', + 'updated_at', + 'snapshot', + ], + title: 'Snapshot', +} as const; + +export const $SnapshotAgent = { + properties: { + id: { + type: 'string', + title: 'Id', + }, + name: { + type: 'string', + title: 'Name', + }, + description: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Description', + }, + preamble: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Preamble', + }, + tools_metadata: { + anyOf: [ + { + items: { + $ref: '#/components/schemas/AgentToolMetadata', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: 'Tools Metadata', + }, + }, + type: 'object', + required: ['id', 'name', 'description', 'preamble', 'tools_metadata'], + title: 'SnapshotAgent', +} as const; + +export const $SnapshotData = { + properties: { + title: { + type: 'string', + title: 'Title', + }, + description: { + type: 'string', + title: 'Description', + }, + messages: { + items: { + $ref: '#/components/schemas/Message', + }, + type: 'array', + title: 'Messages', + }, + agent: { + anyOf: [ + { + $ref: '#/components/schemas/SnapshotAgent', + }, + { + type: 'null', + }, + ], + }, + }, + type: 'object', + required: ['title', 'description', 'messages', 'agent'], + title: 'SnapshotData', +} as const; + +export const $SnapshotWithLinks = { + properties: { + conversation_id: { + type: 'string', + title: 'Conversation Id', + }, + id: { + type: 'string', + title: 'Id', + }, + last_message_id: { + type: 'string', + title: 'Last Message Id', + }, + user_id: { + type: 'string', + title: 'User Id', + }, + organization_id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Organization Id', + }, + version: { + type: 'integer', + title: 'Version', + }, + created_at: { + type: 'string', + format: 'date-time', + title: 'Created At', + }, + updated_at: { + type: 'string', + format: 'date-time', + title: 'Updated At', + }, + snapshot: { + $ref: '#/components/schemas/SnapshotData', + }, + links: { + items: { + type: 'string', + }, + type: 'array', + title: 'Links', + }, + }, + type: 'object', + required: [ + 'conversation_id', + 'id', + 'last_message_id', + 'user_id', + 'organization_id', + 'version', + 'created_at', + 'updated_at', + 'snapshot', + 'links', + ], + title: 'SnapshotWithLinks', +} as const; + +export const $StreamCitationGeneration = { + properties: { + citations: { + items: { + $ref: '#/components/schemas/Citation', + }, + type: 'array', + title: 'Citations for the chat message.', + default: [], + }, + }, + type: 'object', + title: 'StreamCitationGeneration', + description: 'Stream citation generation event.', +} as const; + +export const $StreamEnd = { + properties: { + response_id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Response Id', + }, + generation_id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Generation Id', + }, + conversation_id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Conversation Id', + }, + text: { + type: 'string', + title: 'Contents of the chat message.', + }, + citations: { + items: { + $ref: '#/components/schemas/Citation', + }, + type: 'array', + title: 'Citations for the chat message.', + default: [], + }, + documents: { + items: { + $ref: '#/components/schemas/Document', + }, + type: 'array', + title: 'Documents used to generate grounded response with citations.', + default: [], + }, + search_results: { + items: { + type: 'object', + }, + type: 'array', + title: 'Search results used to generate grounded response with citations.', + default: [], + }, + search_queries: { + items: { + $ref: '#/components/schemas/SearchQuery', + }, + type: 'array', + title: 'List of generated search queries.', + default: [], + }, + tool_calls: { + items: { + $ref: '#/components/schemas/ToolCall', + }, + type: 'array', + title: 'List of tool calls generated for custom tools', + default: [], + }, + finish_reason: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Finish Reason', + }, + chat_history: { + anyOf: [ + { + items: { + $ref: '#/components/schemas/ChatMessage', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: + 'A list of entries used to construct the conversation. If provided, these messages will be used to build the prompt and the conversation_id will be ignored so no data will be stored to maintain state.', + }, + error: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Error message if the response is an error.', + }, + }, + type: 'object', + required: ['text'], + title: 'StreamEnd', +} as const; + +export const $StreamEvent = { + type: 'string', + enum: [ + 'stream-start', + 'search-queries-generation', + 'search-results', + 'tool-input', + 'tool-result', + 'text-generation', + 'citation-generation', + 'stream-end', + 'non-streamed-chat-response', + 'tool-calls-generation', + 'tool-calls-chunk', + ], + title: 'StreamEvent', + description: "Stream Events returned by Cohere's chat stream response.", +} as const; + +export const $StreamQueryGeneration = { + properties: { + query: { + type: 'string', + title: 'Search query used to generate grounded response with citations.', + }, + }, + type: 'object', + required: ['query'], + title: 'StreamQueryGeneration', + description: 'Stream query generation event.', +} as const; + +export const $StreamSearchQueriesGeneration = { + properties: { + search_queries: { + items: { + $ref: '#/components/schemas/SearchQuery', + }, + type: 'array', + title: 'Search query used to generate grounded response with citations.', + default: [], + }, + }, + type: 'object', + title: 'StreamSearchQueriesGeneration', + description: 'Stream queries generation event.', +} as const; + +export const $StreamSearchResults = { + properties: { + search_results: { + items: { + type: 'object', + }, + type: 'array', + title: 'Search results used to generate grounded response with citations.', + default: [], + }, + documents: { + items: { + $ref: '#/components/schemas/Document', + }, + type: 'array', + title: 'Documents used to generate grounded response with citations.', + default: [], + }, + }, + type: 'object', + title: 'StreamSearchResults', +} as const; + +export const $StreamStart = { + properties: { + generation_id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Generation Id', + }, + conversation_id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Conversation Id', + }, + }, + type: 'object', + title: 'StreamStart', + description: 'Stream start event.', +} as const; + +export const $StreamTextGeneration = { + properties: { + text: { + type: 'string', + title: 'Contents of the chat message.', + }, + }, + type: 'object', + required: ['text'], + title: 'StreamTextGeneration', + description: 'Stream text generation event.', +} as const; + +export const $StreamToolCallsChunk = { + properties: { + tool_call_delta: { + anyOf: [ + { + $ref: '#/components/schemas/ToolCallDelta', + }, + { + type: 'null', + }, + ], + title: 'Partial tool call', + default: {}, + }, + text: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Contents of the chat message.', + }, + }, + type: 'object', + required: ['text'], + title: 'StreamToolCallsChunk', +} as const; + +export const $StreamToolCallsGeneration = { + properties: { + tool_calls: { + anyOf: [ + { + items: { + $ref: '#/components/schemas/ToolCall', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: 'List of tool calls generated for custom tools', + default: [], + }, + text: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Contents of the chat message.', + }, + }, + type: 'object', + required: ['text'], + title: 'StreamToolCallsGeneration', + description: 'Stream tool calls generation event.', +} as const; + +export const $StreamToolInput = { + properties: { + input_type: { + $ref: '#/components/schemas/ToolInputType', + }, + tool_name: { + type: 'string', + title: 'Tool Name', + }, + input: { + type: 'string', + title: 'Input', + }, + text: { + type: 'string', + title: 'Text', + }, + }, + type: 'object', + required: ['input_type', 'tool_name', 'input', 'text'], + title: 'StreamToolInput', +} as const; + +export const $StreamToolResult = { + properties: { + result: { + title: 'Result', + }, + tool_name: { + type: 'string', + title: 'Tool Name', + }, + documents: { + items: { + $ref: '#/components/schemas/Document', + }, + type: 'array', + title: 'Documents used to generate grounded response with citations.', + default: [], + }, + }, + type: 'object', + required: ['result', 'tool_name'], + title: 'StreamToolResult', +} as const; + +export const $Tool = { + properties: { + name: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Name', + default: '', + }, + display_name: { + type: 'string', + title: 'Display Name', + default: '', + }, + description: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Description', + default: '', + }, + parameter_definitions: { + anyOf: [ + { + type: 'object', + }, + { + type: 'null', + }, + ], + title: 'Parameter Definitions', + default: {}, + }, + }, + type: 'object', + title: 'Tool', +} as const; + +export const $ToolCall = { + properties: { + name: { + type: 'string', + title: 'Name', + }, + parameters: { + type: 'object', + title: 'Parameters', + default: {}, + }, + }, + type: 'object', + required: ['name'], + title: 'ToolCall', +} as const; + +export const $ToolCallDelta = { + properties: { + name: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Name', + }, + index: { + anyOf: [ + { + type: 'integer', + }, + { + type: 'null', + }, + ], + title: 'Index', + }, + parameters: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Parameters', + }, + }, + type: 'object', + required: ['name', 'index', 'parameters'], + title: 'ToolCallDelta', +} as const; + +export const $ToolInputType = { + type: 'string', + enum: ['QUERY', 'CODE'], + title: 'ToolInputType', + description: 'Type of input passed to the tool', +} as const; + +export const $UpdateAgent = { + properties: { + name: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Name', + }, + version: { + anyOf: [ + { + type: 'integer', + }, + { + type: 'null', + }, + ], + title: 'Version', + }, + description: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Description', + }, + preamble: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Preamble', + }, + temperature: { + anyOf: [ + { + type: 'number', + }, + { + type: 'null', + }, + ], + title: 'Temperature', + }, + model: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Model', + }, + deployment: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Deployment', + }, + tools: { + anyOf: [ + { + items: { + type: 'string', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: 'Tools', + }, + tools_metadata: { + anyOf: [ + { + items: { + $ref: '#/components/schemas/UpdateAgentToolMetadata', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: 'Tools Metadata', + }, + }, + type: 'object', + title: 'UpdateAgent', +} as const; + +export const $UpdateAgentToolMetadata = { + properties: { + id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Id', + }, + tool_name: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Tool Name', + }, + artifacts: { + anyOf: [ + { + items: { + type: 'object', + }, + type: 'array', + }, + { + type: 'null', + }, + ], + title: 'Artifacts', + }, + }, + type: 'object', + title: 'UpdateAgentToolMetadata', +} as const; + +export const $UpdateConversation = { + properties: { + title: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Title', + }, + description: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Description', + }, + }, + type: 'object', + title: 'UpdateConversation', +} as const; + +export const $UpdateDeploymentEnv = { + properties: { + env_vars: { + additionalProperties: { + type: 'string', + }, + type: 'object', + title: 'Env Vars', + }, + }, + type: 'object', + required: ['env_vars'], + title: 'UpdateDeploymentEnv', +} as const; + +export const $UpdateFile = { + properties: { + file_name: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'File Name', + }, + message_id: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Message Id', + }, + }, + type: 'object', + title: 'UpdateFile', +} as const; + +export const $UpdateUser = { + properties: { + password: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Password', + }, + hashed_password: { + anyOf: [ + { + type: 'string', + format: 'binary', + }, + { + type: 'null', + }, + ], + title: 'Hashed Password', + }, + fullname: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Fullname', + }, + email: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Email', + }, + }, + type: 'object', + title: 'UpdateUser', +} as const; + +export const $UploadFile = { + properties: { + id: { + type: 'string', + title: 'Id', + }, + created_at: { + type: 'string', + format: 'date-time', + title: 'Created At', + }, + updated_at: { + type: 'string', + format: 'date-time', + title: 'Updated At', + }, + user_id: { + type: 'string', + title: 'User Id', + }, + conversation_id: { + type: 'string', + title: 'Conversation Id', + }, + file_name: { + type: 'string', + title: 'File Name', + }, + file_path: { + type: 'string', + title: 'File Path', + }, + file_size: { + type: 'integer', + minimum: 0, + title: 'File Size', + default: 0, + }, + }, + type: 'object', + required: [ + 'id', + 'created_at', + 'updated_at', + 'user_id', + 'conversation_id', + 'file_name', + 'file_path', + ], + title: 'UploadFile', +} as const; + +export const $User = { + properties: { + fullname: { + type: 'string', + title: 'Fullname', + }, + email: { + anyOf: [ + { + type: 'string', + }, + { + type: 'null', + }, + ], + title: 'Email', + }, + id: { + type: 'string', + title: 'Id', + }, + created_at: { + type: 'string', + format: 'date-time', + title: 'Created At', + }, + updated_at: { + type: 'string', + format: 'date-time', + title: 'Updated At', + }, + }, + type: 'object', + required: ['fullname', 'id', 'created_at', 'updated_at'], + title: 'User', +} as const; + +export const $ValidationError = { + properties: { + loc: { + items: { + anyOf: [ + { + type: 'string', + }, + { + type: 'integer', + }, + ], + }, + type: 'array', + title: 'Location', + }, + msg: { + type: 'string', + title: 'Message', + }, + type: { + type: 'string', + title: 'Error Type', + }, + }, + type: 'object', + required: ['loc', 'msg', 'type'], + title: 'ValidationError', +} as const; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/services.gen.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/services.gen.ts new file mode 100644 index 0000000000000000000000000000000000000000..f0ebee6ec889dd6a852853f5d7c7f73437ffaac0 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/services.gen.ts @@ -0,0 +1,1422 @@ +// This file is auto-generated by @hey-api/openapi-ts +import type { BaseHttpRequest } from './core/BaseHttpRequest'; +import type { CancelablePromise } from './core/CancelablePromise'; +import type { + ApplyMigrationsMigratePostResponse, + AuthorizeV1StrategyAuthPostData, + AuthorizeV1StrategyAuthPostResponse, + ChatStreamV1ChatStreamPostData, + ChatStreamV1ChatStreamPostResponse, + ChatV1ChatPostData, + ChatV1ChatPostResponse, + CreateAgentToolMetadataV1AgentsAgentIdToolMetadataPostData, + CreateAgentToolMetadataV1AgentsAgentIdToolMetadataPostResponse, + CreateAgentV1AgentsPostData, + CreateAgentV1AgentsPostResponse, + CreateSnapshotV1SnapshotsPostData, + CreateSnapshotV1SnapshotsPostResponse, + CreateUserV1UsersPostData, + CreateUserV1UsersPostResponse, + DeleteAgentToolMetadataV1AgentsAgentIdToolMetadataAgentToolMetadataIdDeleteData, + DeleteAgentToolMetadataV1AgentsAgentIdToolMetadataAgentToolMetadataIdDeleteResponse, + DeleteAgentV1AgentsAgentIdDeleteData, + DeleteAgentV1AgentsAgentIdDeleteResponse, + DeleteConversationV1ConversationsConversationIdDeleteData, + DeleteConversationV1ConversationsConversationIdDeleteResponse, + DeleteFileV1ConversationsConversationIdFilesFileIdDeleteData, + DeleteFileV1ConversationsConversationIdFilesFileIdDeleteResponse, + DeleteSnapshotLinkV1SnapshotsLinkLinkIdDeleteData, + DeleteSnapshotLinkV1SnapshotsLinkLinkIdDeleteResponse, + DeleteSnapshotV1SnapshotsSnapshotIdDeleteData, + DeleteSnapshotV1SnapshotsSnapshotIdDeleteResponse, + DeleteUserV1UsersUserIdDeleteData, + DeleteUserV1UsersUserIdDeleteResponse, + GenerateTitleV1ConversationsConversationIdGenerateTitlePostData, + GenerateTitleV1ConversationsConversationIdGenerateTitlePostResponse, + GetAgentByIdV1AgentsAgentIdGetData, + GetAgentByIdV1AgentsAgentIdGetResponse, + GetConversationV1ConversationsConversationIdGetData, + GetConversationV1ConversationsConversationIdGetResponse, + GetSnapshotV1SnapshotsLinkLinkIdGetData, + GetSnapshotV1SnapshotsLinkLinkIdGetResponse, + GetStrategiesV1AuthStrategiesGetResponse, + GetUserV1UsersUserIdGetData, + GetUserV1UsersUserIdGetResponse, + HealthHealthGetResponse, + LangchainChatStreamV1LangchainChatPostData, + LangchainChatStreamV1LangchainChatPostResponse, + ListAgentToolMetadataV1AgentsAgentIdToolMetadataGetData, + ListAgentToolMetadataV1AgentsAgentIdToolMetadataGetResponse, + ListAgentsV1AgentsGetData, + ListAgentsV1AgentsGetResponse, + ListConversationsV1ConversationsGetData, + ListConversationsV1ConversationsGetResponse, + ListDeploymentsV1DeploymentsGetData, + ListDeploymentsV1DeploymentsGetResponse, + ListExperimentalFeaturesV1ExperimentalFeaturesGetResponse, + ListFilesV1ConversationsConversationIdFilesGetData, + ListFilesV1ConversationsConversationIdFilesGetResponse, + ListSnapshotsV1SnapshotsGetResponse, + ListToolsV1ToolsGetData, + ListToolsV1ToolsGetResponse, + ListUsersV1UsersGetData, + ListUsersV1UsersGetResponse, + LoginV1LoginPostData, + LoginV1LoginPostResponse, + LoginV1ToolAuthGetResponse, + LogoutV1LogoutGetResponse, + SearchConversationsV1ConversationsSearchGetData, + SearchConversationsV1ConversationsSearchGetResponse, + SetEnvVarsV1DeploymentsNameSetEnvVarsPostData, + SetEnvVarsV1DeploymentsNameSetEnvVarsPostResponse, + UpdateAgentToolMetadataV1AgentsAgentIdToolMetadataAgentToolMetadataIdPutData, + UpdateAgentToolMetadataV1AgentsAgentIdToolMetadataAgentToolMetadataIdPutResponse, + UpdateAgentV1AgentsAgentIdPutData, + UpdateAgentV1AgentsAgentIdPutResponse, + UpdateConversationV1ConversationsConversationIdPutData, + UpdateConversationV1ConversationsConversationIdPutResponse, + UpdateFileV1ConversationsConversationIdFilesFileIdPutData, + UpdateFileV1ConversationsConversationIdFilesFileIdPutResponse, + UpdateUserV1UsersUserIdPutData, + UpdateUserV1UsersUserIdPutResponse, + UploadFileV1ConversationsUploadFilePostData, + UploadFileV1ConversationsUploadFilePostResponse, +} from './types.gen'; + +export class DefaultService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * Get Strategies + * Retrieves the currently enabled list of Authentication strategies. + * + * + * Returns: + * List[dict]: List of dictionaries containing the enabled auth strategy names. + * @returns ListAuthStrategy Successful Response + * @throws ApiError + */ + public getStrategiesV1AuthStrategiesGet(): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/v1/auth_strategies', + }); + } + + /** + * Login + * Logs user in, performing basic email/password auth. + * Verifies their credentials, retrieves the user and returns a JWT token. + * + * Args: + * request (Request): current Request object. + * login (Login): Login payload. + * session (DBSessionDep): Database session. + * + * Returns: + * dict: JWT token on Basic auth success + * + * Raises: + * HTTPException: If the strategy or payload are invalid, or if the login fails. + * @param data The data for the request. + * @param data.requestBody + * @returns unknown Successful Response + * @throws ApiError + */ + public loginV1LoginPost(data: LoginV1LoginPostData): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/v1/login', + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Authorize + * Callback authorization endpoint used for OAuth providers after authenticating on the provider's login screen. + * + * Args: + * strategy (str): Current strategy name. + * request (Request): Current Request object. + * session (Session): DB session. + * + * Returns: + * dict: Containing "token" key, on success. + * + * Raises: + * HTTPException: If authentication fails, or strategy is invalid. + * @param data The data for the request. + * @param data.strategy + * @param data.code + * @returns JWTResponse Successful Response + * @throws ApiError + */ + public authorizeV1StrategyAuthPost( + data: AuthorizeV1StrategyAuthPostData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/v1/{strategy}/auth', + path: { + strategy: data.strategy, + }, + query: { + code: data.code, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Logout + * Logs out the current user, adding the given JWT token to the blacklist. + * + * Args: + * request (Request): current Request object. + * + * Returns: + * dict: Empty on success + * @returns Logout Successful Response + * @throws ApiError + */ + public logoutV1LogoutGet(): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/v1/logout', + }); + } + + /** + * Login + * Logs user in, performing basic email/password auth. + * Verifies their credentials, retrieves the user and returns a JWT token. + * + * Args: + * request (Request): current Request object. + * login (Login): Login payload. + * session (DBSessionDep): Database session. + * + * Returns: + * dict: JWT token on Basic auth success + * + * Raises: + * HTTPException: If the strategy or payload are invalid, or if the login fails. + * @returns unknown Successful Response + * @throws ApiError + */ + public loginV1ToolAuthGet(): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/v1/tool/auth', + }); + } + + /** + * Chat Stream + * Stream chat endpoint to handle user messages and return chatbot responses. + * + * Args: + * session (DBSessionDep): Database session. + * chat_request (CohereChatRequest): Chat request data. + * request (Request): Request object. + * agent_id (str | None): Agent ID. + * + * Returns: + * EventSourceResponse: Server-sent event response with chatbot responses. + * @param data The data for the request. + * @param data.requestBody + * @param data.agentId + * @returns ChatResponseEvent Successful Response + * @throws ApiError + */ + public chatStreamV1ChatStreamPost( + data: ChatStreamV1ChatStreamPostData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/v1/chat-stream', + query: { + agent_id: data.agentId, + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Chat + * Chat endpoint to handle user messages and return chatbot responses. + * + * Args: + * chat_request (CohereChatRequest): Chat request data. + * session (DBSessionDep): Database session. + * request (Request): Request object. + * agent_id (str | None): Agent ID. + * deployment_name: Deployment name header. + * + * Returns: + * NonStreamedChatResponse: Chatbot response. + * @param data The data for the request. + * @param data.requestBody + * @param data.agentId + * @param data.deploymentName + * @returns NonStreamedChatResponse Successful Response + * @throws ApiError + */ + public chatV1ChatPost(data: ChatV1ChatPostData): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/v1/chat', + headers: { + 'deployment-name': data.deploymentName, + }, + query: { + agent_id: data.agentId, + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Langchain Chat Stream + * @param data The data for the request. + * @param data.requestBody + * @returns unknown Successful Response + * @throws ApiError + */ + public langchainChatStreamV1LangchainChatPost( + data: LangchainChatStreamV1LangchainChatPostData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/v1/langchain-chat', + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Create User + * Create a new user. + * + * Args: + * user (CreateUser): User data to be created. + * session (DBSessionDep): Database session. + * + * Returns: + * User: Created user. + * @param data The data for the request. + * @param data.requestBody + * @returns User Successful Response + * @throws ApiError + */ + public createUserV1UsersPost( + data: CreateUserV1UsersPostData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/v1/users', + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * List Users + * List all users. + * + * Args: + * offset (int): Offset to start the list. + * limit (int): Limit of users to be listed. + * session (DBSessionDep): Database session. + * + * Returns: + * list[User]: List of users. + * @param data The data for the request. + * @param data.offset + * @param data.limit + * @returns User Successful Response + * @throws ApiError + */ + public listUsersV1UsersGet( + data: ListUsersV1UsersGetData = {}, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/v1/users', + query: { + offset: data.offset, + limit: data.limit, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Get User + * Get a user by ID. + * + * Args: + * user_id (str): User ID. + * session (DBSessionDep): Database session. + * + * Returns: + * User: User with the given ID. + * + * Raises: + * HTTPException: If the user with the given ID is not found. + * @param data The data for the request. + * @param data.userId + * @returns User Successful Response + * @throws ApiError + */ + public getUserV1UsersUserIdGet( + data: GetUserV1UsersUserIdGetData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/v1/users/{user_id}', + path: { + user_id: data.userId, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Update User + * Update a user by ID. + * + * Args: + * user_id (str): User ID. + * new_user (UpdateUser): New user data. + * session (DBSessionDep): Database session. + * + * Returns: + * User: Updated user. + * + * Raises: + * HTTPException: If the user with the given ID is not found. + * @param data The data for the request. + * @param data.userId + * @param data.requestBody + * @returns User Successful Response + * @throws ApiError + */ + public updateUserV1UsersUserIdPut( + data: UpdateUserV1UsersUserIdPutData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'PUT', + url: '/v1/users/{user_id}', + path: { + user_id: data.userId, + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Delete User + * " + * Delete a user by ID. + * + * Args: + * user_id (str): User ID. + * session (DBSessionDep): Database session. + * + * Returns: + * DeleteUser: Empty response. + * + * Raises: + * HTTPException: If the user with the given ID is not found. + * @param data The data for the request. + * @param data.userId + * @returns DeleteUser Successful Response + * @throws ApiError + */ + public deleteUserV1UsersUserIdDelete( + data: DeleteUserV1UsersUserIdDeleteData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'DELETE', + url: '/v1/users/{user_id}', + path: { + user_id: data.userId, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Get Conversation + * " + * Get a conversation by ID. + * + * Args: + * conversation_id (str): Conversation ID. + * session (DBSessionDep): Database session. + * request (Request): Request object. + * + * Returns: + * Conversation: Conversation with the given ID. + * + * Raises: + * HTTPException: If the conversation with the given ID is not found. + * @param data The data for the request. + * @param data.conversationId + * @returns Conversation Successful Response + * @throws ApiError + */ + public getConversationV1ConversationsConversationIdGet( + data: GetConversationV1ConversationsConversationIdGetData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/v1/conversations/{conversation_id}', + path: { + conversation_id: data.conversationId, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Update Conversation + * Update a conversation by ID. + * + * Args: + * conversation_id (str): Conversation ID. + * new_conversation (UpdateConversation): New conversation data. + * session (DBSessionDep): Database session. + * request (Request): Request object. + * + * Returns: + * Conversation: Updated conversation. + * + * Raises: + * HTTPException: If the conversation with the given ID is not found. + * @param data The data for the request. + * @param data.conversationId + * @param data.requestBody + * @returns Conversation Successful Response + * @throws ApiError + */ + public updateConversationV1ConversationsConversationIdPut( + data: UpdateConversationV1ConversationsConversationIdPutData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'PUT', + url: '/v1/conversations/{conversation_id}', + path: { + conversation_id: data.conversationId, + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Delete Conversation + * Delete a conversation by ID. + * + * Args: + * conversation_id (str): Conversation ID. + * session (DBSessionDep): Database session. + * request (Request): Request object. + * + * Returns: + * DeleteConversation: Empty response. + * + * Raises: + * HTTPException: If the conversation with the given ID is not found. + * @param data The data for the request. + * @param data.conversationId + * @returns DeleteConversation Successful Response + * @throws ApiError + */ + public deleteConversationV1ConversationsConversationIdDelete( + data: DeleteConversationV1ConversationsConversationIdDeleteData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'DELETE', + url: '/v1/conversations/{conversation_id}', + path: { + conversation_id: data.conversationId, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * List Conversations + * List all conversations. + * + * Args: + * offset (int): Offset to start the list. + * limit (int): Limit of conversations to be listed. + * agent_id (str): Query parameter for agent ID to optionally filter conversations by agent. + * session (DBSessionDep): Database session. + * request (Request): Request object. + * + * Returns: + * list[ConversationWithoutMessages]: List of conversations. + * @param data The data for the request. + * @param data.offset + * @param data.limit + * @param data.agentId + * @returns ConversationWithoutMessages Successful Response + * @throws ApiError + */ + public listConversationsV1ConversationsGet( + data: ListConversationsV1ConversationsGetData = {}, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/v1/conversations', + query: { + offset: data.offset, + limit: data.limit, + agent_id: data.agentId, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Search Conversations + * Search conversations by title. + * + * Args: + * query (str): Query string to search for in conversation titles. + * session (DBSessionDep): Database session. + * request (Request): Request object. + * + * Returns: + * list[ConversationWithoutMessages]: List of conversations that match the query. + * @param data The data for the request. + * @param data.query + * @param data.offset + * @param data.limit + * @param data.agentId + * @returns ConversationWithoutMessages Successful Response + * @throws ApiError + */ + public searchConversationsV1ConversationsSearchGet( + data: SearchConversationsV1ConversationsSearchGetData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/v1/conversations:search', + query: { + query: data.query, + offset: data.offset, + limit: data.limit, + agent_id: data.agentId, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Upload File + * Uploads and creates a File object. + * If no conversation_id is provided, a new Conversation is created as well. + * + * Args: + * session (DBSessionDep): Database session. + * file (FastAPIUploadFile): File to be uploaded. + * conversation_id (Optional[str]): Conversation ID passed from request query parameter. + * + * Returns: + * UploadFile: Uploaded file. + * + * Raises: + * HTTPException: If the conversation with the given ID is not found. Status code 404. + * HTTPException: If the file wasn't uploaded correctly. Status code 500. + * @param data The data for the request. + * @param data.formData + * @returns UploadFile Successful Response + * @throws ApiError + */ + public uploadFileV1ConversationsUploadFilePost( + data: UploadFileV1ConversationsUploadFilePostData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/v1/conversations/upload_file', + formData: data.formData, + mediaType: 'multipart/form-data', + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * List Files + * List all files from a conversation. Important - no pagination support yet. + * + * Args: + * conversation_id (str): Conversation ID. + * session (DBSessionDep): Database session. + * + * Returns: + * list[ListFile]: List of files from the conversation. + * + * Raises: + * HTTPException: If the conversation with the given ID is not found. + * @param data The data for the request. + * @param data.conversationId + * @returns ListFile Successful Response + * @throws ApiError + */ + public listFilesV1ConversationsConversationIdFilesGet( + data: ListFilesV1ConversationsConversationIdFilesGetData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/v1/conversations/{conversation_id}/files', + path: { + conversation_id: data.conversationId, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Update File + * Update a file by ID. + * + * Args: + * conversation_id (str): Conversation ID. + * file_id (str): File ID. + * new_file (UpdateFile): New file data. + * session (DBSessionDep): Database session. + * + * Returns: + * File: Updated file. + * + * Raises: + * HTTPException: If the conversation with the given ID is not found. + * @param data The data for the request. + * @param data.conversationId + * @param data.fileId + * @param data.requestBody + * @returns File Successful Response + * @throws ApiError + */ + public updateFileV1ConversationsConversationIdFilesFileIdPut( + data: UpdateFileV1ConversationsConversationIdFilesFileIdPutData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'PUT', + url: '/v1/conversations/{conversation_id}/files/{file_id}', + path: { + conversation_id: data.conversationId, + file_id: data.fileId, + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Delete File + * Delete a file by ID. + * + * Args: + * conversation_id (str): Conversation ID. + * file_id (str): File ID. + * session (DBSessionDep): Database session. + * + * Returns: + * DeleteFile: Empty response. + * + * Raises: + * HTTPException: If the conversation with the given ID is not found. + * @param data The data for the request. + * @param data.conversationId + * @param data.fileId + * @returns DeleteFile Successful Response + * @throws ApiError + */ + public deleteFileV1ConversationsConversationIdFilesFileIdDelete( + data: DeleteFileV1ConversationsConversationIdFilesFileIdDeleteData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'DELETE', + url: '/v1/conversations/{conversation_id}/files/{file_id}', + path: { + conversation_id: data.conversationId, + file_id: data.fileId, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Generate Title + * Generate a title for a conversation and update the conversation with the generated title. + * + * Args: + * conversation_id (str): Conversation ID. + * session (DBSessionDep): Database session. + * + * Returns: + * str: Generated title for the conversation. + * + * Raises: + * HTTPException: If the conversation with the given ID is not found. + * @param data The data for the request. + * @param data.conversationId + * @returns GenerateTitle Successful Response + * @throws ApiError + */ + public generateTitleV1ConversationsConversationIdGenerateTitlePost( + data: GenerateTitleV1ConversationsConversationIdGenerateTitlePostData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/v1/conversations/{conversation_id}/generate-title', + path: { + conversation_id: data.conversationId, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * List Tools + * List all available tools. + * + * Returns: + * list[ManagedTool]: List of available tools. + * @param data The data for the request. + * @param data.agentId + * @returns ManagedTool Successful Response + * @throws ApiError + */ + public listToolsV1ToolsGet( + data: ListToolsV1ToolsGetData = {}, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/v1/tools', + query: { + agent_id: data.agentId, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * List Deployments + * List all available deployments and their models. + * + * Returns: + * list[Deployment]: List of available deployment options. + * @param data The data for the request. + * @param data.all + * @returns Deployment Successful Response + * @throws ApiError + */ + public listDeploymentsV1DeploymentsGet( + data: ListDeploymentsV1DeploymentsGetData = {}, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/v1/deployments', + query: { + all: data.all, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Set Env Vars + * Set environment variables for the deployment. + * + * Returns: + * str: Empty string. + * @param data The data for the request. + * @param data.name + * @param data.requestBody + * @returns unknown Successful Response + * @throws ApiError + */ + public setEnvVarsV1DeploymentsNameSetEnvVarsPost( + data: SetEnvVarsV1DeploymentsNameSetEnvVarsPostData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/v1/deployments/{name}/set_env_vars', + path: { + name: data.name, + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * List Experimental Features + * List all experimental features and if they are enabled + * + * Returns: + * Dict[str, bool]: Experimental feature and their isEnabled state + * @returns unknown Successful Response + * @throws ApiError + */ + public listExperimentalFeaturesV1ExperimentalFeaturesGet(): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/v1/experimental_features/', + }); + } + + /** + * Create Agent + * Create an agent. + * Args: + * session (DBSessionDep): Database session. + * agent (CreateAgent): Agent data. + * request (Request): Request object. + * Returns: + * Agent: Created agent. + * Raises: + * HTTPException: If the agent creation fails. + * @param data The data for the request. + * @param data.requestBody + * @returns Agent Successful Response + * @throws ApiError + */ + public createAgentV1AgentsPost( + data: CreateAgentV1AgentsPostData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/v1/agents', + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * List Agents + * List all agents. + * + * Args: + * offset (int): Offset to start the list. + * limit (int): Limit of agents to be listed. + * session (DBSessionDep): Database session. + * request (Request): Request object. + * + * Returns: + * list[Agent]: List of agents. + * @param data The data for the request. + * @param data.offset + * @param data.limit + * @returns Agent Successful Response + * @throws ApiError + */ + public listAgentsV1AgentsGet( + data: ListAgentsV1AgentsGetData = {}, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/v1/agents', + query: { + offset: data.offset, + limit: data.limit, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Get Agent By Id + * Args: + * agent_id (str): Agent ID. + * session (DBSessionDep): Database session. + * + * Returns: + * Agent: Agent. + * + * Raises: + * HTTPException: If the agent with the given ID is not found. + * @param data The data for the request. + * @param data.agentId + * @returns Agent Successful Response + * @throws ApiError + */ + public getAgentByIdV1AgentsAgentIdGet( + data: GetAgentByIdV1AgentsAgentIdGetData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/v1/agents/{agent_id}', + path: { + agent_id: data.agentId, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Update Agent + * Update an agent by ID. + * + * Args: + * agent_id (str): Agent ID. + * new_agent (UpdateAgent): New agent data. + * session (DBSessionDep): Database session. + * request (Request): Request object. + * + * Returns: + * Agent: Updated agent. + * + * Raises: + * HTTPException: If the agent with the given ID is not found. + * @param data The data for the request. + * @param data.agentId + * @param data.requestBody + * @returns Agent Successful Response + * @throws ApiError + */ + public updateAgentV1AgentsAgentIdPut( + data: UpdateAgentV1AgentsAgentIdPutData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'PUT', + url: '/v1/agents/{agent_id}', + path: { + agent_id: data.agentId, + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Delete Agent + * Delete an agent by ID. + * + * Args: + * agent_id (str): Agent ID. + * session (DBSessionDep): Database session. + * request (Request): Request object. + * + * Returns: + * DeleteAgent: Empty response. + * + * Raises: + * HTTPException: If the agent with the given ID is not found. + * @param data The data for the request. + * @param data.agentId + * @returns DeleteAgent Successful Response + * @throws ApiError + */ + public deleteAgentV1AgentsAgentIdDelete( + data: DeleteAgentV1AgentsAgentIdDeleteData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'DELETE', + url: '/v1/agents/{agent_id}', + path: { + agent_id: data.agentId, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * List Agent Tool Metadata + * List all agent tool metadata by agent ID. + * + * Args: + * agent_id (str): Agent ID. + * session (DBSessionDep): Database session. + * request (Request): Request object. + * + * Returns: + * list[AgentToolMetadata]: List of agent tool metadata. + * + * Raises: + * HTTPException: If the agent tool metadata retrieval fails. + * @param data The data for the request. + * @param data.agentId + * @returns AgentToolMetadata Successful Response + * @throws ApiError + */ + public listAgentToolMetadataV1AgentsAgentIdToolMetadataGet( + data: ListAgentToolMetadataV1AgentsAgentIdToolMetadataGetData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/v1/agents/{agent_id}/tool-metadata', + path: { + agent_id: data.agentId, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Create Agent Tool Metadata + * Create an agent tool metadata. + * + * Args: + * session (DBSessionDep): Database session. + * agent_id (str): Agent ID. + * agent_tool_metadata (CreateAgentToolMetadata): Agent tool metadata data. + * request (Request): Request object. + * + * Returns: + * AgentToolMetadata: Created agent tool metadata. + * + * Raises: + * HTTPException: If the agent tool metadata creation fails. + * @param data The data for the request. + * @param data.agentId + * @param data.requestBody + * @returns AgentToolMetadata Successful Response + * @throws ApiError + */ + public createAgentToolMetadataV1AgentsAgentIdToolMetadataPost( + data: CreateAgentToolMetadataV1AgentsAgentIdToolMetadataPostData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/v1/agents/{agent_id}/tool-metadata', + path: { + agent_id: data.agentId, + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Update Agent Tool Metadata + * Update an agent tool metadata by ID. + * + * Args: + * agent_id (str): Agent ID. + * agent_tool_metadata_id (str): Agent tool metadata ID. + * session (DBSessionDep): Database session. + * new_agent_tool_metadata (UpdateAgentToolMetadata): New agent tool metadata data. + * request (Request): Request object. + * + * Returns: + * AgentToolMetadata: Updated agent tool metadata. + * + * Raises: + * HTTPException: If the agent tool metadata with the given ID is not found. + * HTTPException: If the agent tool metadata update fails. + * @param data The data for the request. + * @param data.agentId + * @param data.agentToolMetadataId + * @param data.requestBody + * @returns AgentToolMetadata Successful Response + * @throws ApiError + */ + public updateAgentToolMetadataV1AgentsAgentIdToolMetadataAgentToolMetadataIdPut( + data: UpdateAgentToolMetadataV1AgentsAgentIdToolMetadataAgentToolMetadataIdPutData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'PUT', + url: '/v1/agents/{agent_id}/tool-metadata/{agent_tool_metadata_id}', + path: { + agent_id: data.agentId, + agent_tool_metadata_id: data.agentToolMetadataId, + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Delete Agent Tool Metadata + * Delete an agent tool metadata by ID. + * + * Args: + * agent_id (str): Agent ID. + * agent_tool_metadata_id (str): Agent tool metadata ID. + * session (DBSessionDep): Database session. + * request (Request): Request object. + * + * Returns: + * DeleteAgentToolMetadata: Empty response. + * + * Raises: + * HTTPException: If the agent tool metadata with the given ID is not found. + * HTTPException: If the agent tool metadata deletion fails. + * @param data The data for the request. + * @param data.agentId + * @param data.agentToolMetadataId + * @returns DeleteAgentToolMetadata Successful Response + * @throws ApiError + */ + public deleteAgentToolMetadataV1AgentsAgentIdToolMetadataAgentToolMetadataIdDelete( + data: DeleteAgentToolMetadataV1AgentsAgentIdToolMetadataAgentToolMetadataIdDeleteData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'DELETE', + url: '/v1/agents/{agent_id}/tool-metadata/{agent_tool_metadata_id}', + path: { + agent_id: data.agentId, + agent_tool_metadata_id: data.agentToolMetadataId, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * List Snapshots + * List all snapshots. + * + * Args: + * session (DBSessionDep): Database session. + * request (Request): HTTP request object. + * + * Returns: + * list[Snapshot]: List of all snapshots. + * @returns SnapshotWithLinks Successful Response + * @throws ApiError + */ + public listSnapshotsV1SnapshotsGet(): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/v1/snapshots', + }); + } + + /** + * Create Snapshot + * Create a new snapshot and snapshot link to share the conversation. + * + * Args: + * snapshot_request (CreateSnapshot): Snapshot creation request. + * session (DBSessionDep): Database session. + * request (Request): HTTP request object. + * + * Returns: + * CreateSnapshotResponse: Snapshot creation response. + * @param data The data for the request. + * @param data.requestBody + * @returns CreateSnapshotResponse Successful Response + * @throws ApiError + */ + public createSnapshotV1SnapshotsPost( + data: CreateSnapshotV1SnapshotsPostData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/v1/snapshots', + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Get Snapshot + * Get a snapshot by link ID. + * + * Args: + * link_id (str): Snapshot link ID. + * session (DBSessionDep): Database session. + * request (Request): HTTP request object. + * + * Returns: + * Snapshot: Snapshot with the given link ID. + * @param data The data for the request. + * @param data.linkId + * @returns Snapshot Successful Response + * @throws ApiError + */ + public getSnapshotV1SnapshotsLinkLinkIdGet( + data: GetSnapshotV1SnapshotsLinkLinkIdGetData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/v1/snapshots/link/{link_id}', + path: { + link_id: data.linkId, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Delete Snapshot Link + * Delete a snapshot link by ID. + * + * Args: + * link_id (str): Snapshot link ID. + * session (DBSessionDep): Database session. + * request (Request): HTTP request object. + * + * Returns: + * Any: Empty response. + * @param data The data for the request. + * @param data.linkId + * @returns unknown Successful Response + * @throws ApiError + */ + public deleteSnapshotLinkV1SnapshotsLinkLinkIdDelete( + data: DeleteSnapshotLinkV1SnapshotsLinkLinkIdDeleteData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'DELETE', + url: '/v1/snapshots/link/{link_id}', + path: { + link_id: data.linkId, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Delete Snapshot + * Delete a snapshot by ID. + * + * Args: + * snapshot_id (str): Snapshot ID. + * session (DBSessionDep): Database session. + * request (Request): HTTP request object. + * + * Returns: + * Any: Empty response. + * @param data The data for the request. + * @param data.snapshotId + * @returns unknown Successful Response + * @throws ApiError + */ + public deleteSnapshotV1SnapshotsSnapshotIdDelete( + data: DeleteSnapshotV1SnapshotsSnapshotIdDeleteData, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'DELETE', + url: '/v1/snapshots/{snapshot_id}', + path: { + snapshot_id: data.snapshotId, + }, + errors: { + 422: 'Validation Error', + }, + }); + } + + /** + * Health + * Health check for backend APIs + * @returns unknown Successful Response + * @throws ApiError + */ + public healthHealthGet(): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/health', + }); + } + + /** + * Apply Migrations + * Applies Alembic migrations - useful for serverless applications + * @returns unknown Successful Response + * @throws ApiError + */ + public applyMigrationsMigratePost(): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/migrate', + }); + } +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/types.gen.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/types.gen.ts new file mode 100644 index 0000000000000000000000000000000000000000..44d8794afcb450a994982c81acdcbc828466d02e --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/generated/types.gen.ts @@ -0,0 +1,1497 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type Agent = { + user_id: string; + organization_id?: string | null; + id: string; + created_at: string; + updated_at: string; + version: number; + name: string; + description: string | null; + preamble: string | null; + temperature: number; + tools: Array; + tools_metadata: Array; + model: string; + deployment: string; +}; + +export type AgentToolMetadata = { + user_id: string; + organization_id?: string | null; + id: string; + tool_name: string; + artifacts: Array<{ + [key: string]: unknown; + }>; +}; + +export type Body_upload_file_v1_conversations_upload_file_post = { + conversation_id?: string; + file: Blob | File; +}; + +export type Category = 'File loader' | 'Data loader' | 'Function'; + +/** + * A list of previous messages between the user and the model, meant to give the model conversational context for responding to the user's message. + */ +export type ChatMessage = { + role: ChatRole; + message?: string | null; + tool_plan?: string | null; + tool_results?: Array<{ + [key: string]: unknown; + }> | null; + tool_calls?: Array<{ + [key: string]: unknown; + }> | null; +}; + +export type ChatResponseEvent = { + event: StreamEvent; + data: + | StreamStart + | StreamTextGeneration + | StreamCitationGeneration + | StreamQueryGeneration + | StreamSearchResults + | StreamEnd + | StreamToolInput + | StreamToolResult + | StreamSearchQueriesGeneration + | StreamToolCallsGeneration + | StreamToolCallsChunk + | NonStreamedChatResponse; +}; + +/** + * One of CHATBOT|USER|SYSTEM to identify who the message is coming from. + */ +export type ChatRole = 'CHATBOT' | 'USER' | 'SYSTEM' | 'TOOL'; + +export type Citation = { + text: string; + start: number; + end: number; + document_ids: Array; +}; + +/** + * Dictates how the prompt will be constructed. Defaults to "AUTO_PRESERVE_ORDER". + */ +export type CohereChatPromptTruncation = 'OFF' | 'AUTO_PRESERVE_ORDER'; + +/** + * Request shape for Cohere Python SDK Streamed Chat. + * See: https://github.com/cohere-ai/cohere-python/blob/main/src/cohere/base_client.py#L1629 + */ +export type CohereChatRequest = { + message: string; + chat_history?: Array | null; + conversation_id?: string; + tools?: Array | null; + documents?: Array<{ + [key: string]: unknown; + }>; + model?: string | null; + temperature?: number | null; + k?: number | null; + p?: number | null; + preamble?: string | null; + file_ids?: Array | null; + search_queries_only?: boolean | null; + max_tokens?: number | null; + seed?: number | null; + stop_sequences?: Array | null; + presence_penalty?: number | null; + frequency_penalty?: number | null; + prompt_truncation?: CohereChatPromptTruncation; + tool_results?: Array<{ + [key: string]: unknown; + }> | null; + force_single_step?: boolean | null; +}; + +export type Conversation = { + user_id: string; + organization_id?: string | null; + id: string; + created_at: string; + updated_at: string; + title: string; + messages: Array; + files: Array; + description: string | null; + agent_id: string | null; + readonly total_file_size: number; +}; + +export type ConversationWithoutMessages = { + user_id: string; + organization_id?: string | null; + id: string; + created_at: string; + updated_at: string; + title: string; + files: Array; + description: string | null; + agent_id: string | null; + readonly total_file_size: number; +}; + +export type CreateAgent = { + name: string; + version?: number | null; + description?: string | null; + preamble?: string | null; + temperature?: number | null; + model: string; + deployment: string; + tools?: Array | null; + tools_metadata?: Array | null; +}; + +export type CreateAgentToolMetadata = { + tool_name: string; + artifacts: Array<{ + [key: string]: unknown; + }>; +}; + +export type CreateSnapshot = { + conversation_id: string; +}; + +export type CreateSnapshotResponse = { + snapshot_id: string; + user_id: string; + link_id: string; + messages: Array; +}; + +export type CreateUser = { + password?: string | null; + hashed_password?: (Blob | File) | null; + fullname: string; + email?: string | null; +}; + +export type DeleteAgent = unknown; + +export type DeleteAgentToolMetadata = unknown; + +export type DeleteConversation = unknown; + +export type DeleteFile = unknown; + +export type DeleteUser = unknown; + +export type Deployment = { + name: string; + models: Array; + is_available: boolean; + env_vars: Array; +}; + +export type Document = { + text: string; + document_id: string; + title: string | null; + url: string | null; + fields: { + [key: string]: unknown; + } | null; + tool_name: string | null; +}; + +export type File = { + id: string; + created_at: string; + updated_at: string; + user_id: string; + conversation_id: string; + file_name: string; + file_path: string; + file_size?: number; +}; + +export type GenerateTitle = { + title: string; +}; + +export type HTTPValidationError = { + detail?: Array; +}; + +export type JWTResponse = { + token: string; +}; + +/** + * Request shape for Langchain Streamed Chat. + */ +export type LangchainChatRequest = { + message: string; + chat_history?: Array | null; + conversation_id?: string; + tools?: Array | null; +}; + +export type ListAuthStrategy = { + strategy: string; + client_id: string | null; + authorization_endpoint: string | null; + pkce_enabled: boolean; +}; + +export type ListFile = { + id: string; + created_at: string; + updated_at: string; + user_id: string; + conversation_id: string; + file_name: string; + file_path: string; + file_size?: number; +}; + +export type Login = { + strategy: string; + payload?: { + [key: string]: string; + } | null; +}; + +export type Logout = unknown; + +export type ManagedTool = { + name?: string | null; + display_name?: string; + description?: string | null; + parameter_definitions?: { + [key: string]: unknown; + } | null; + kwargs?: { + [key: string]: unknown; + }; + is_visible?: boolean; + is_available?: boolean; + error_message?: string | null; + category?: Category; + is_auth_required?: boolean; + auth_url?: string | null; +}; + +export type Message = { + text: string; + id: string; + created_at: string; + updated_at: string; + generation_id: string | null; + position: number; + is_active: boolean; + documents: Array; + citations: Array; + files: Array; + tool_calls: Array; + tool_plan: string | null; + agent: MessageAgent; +}; + +export type MessageAgent = 'USER' | 'CHATBOT'; + +export type NonStreamedChatResponse = { + response_id: string | null; + generation_id: string | null; + chat_history: Array | null; + finish_reason: string; + text: string; + citations?: Array | null; + documents?: Array | null; + search_results?: Array<{ + [key: string]: unknown; + }> | null; + search_queries?: Array | null; + conversation_id: string | null; + tool_calls?: Array | null; +}; + +export type SearchQuery = { + text: string; + generation_id: string; +}; + +export type Snapshot = { + conversation_id: string; + id: string; + last_message_id: string; + user_id: string; + organization_id: string | null; + version: number; + created_at: string; + updated_at: string; + snapshot: SnapshotData; +}; + +export type SnapshotAgent = { + id: string; + name: string; + description: string | null; + preamble: string | null; + tools_metadata: Array | null; +}; + +export type SnapshotData = { + title: string; + description: string; + messages: Array; + agent: SnapshotAgent | null; +}; + +export type SnapshotWithLinks = { + conversation_id: string; + id: string; + last_message_id: string; + user_id: string; + organization_id: string | null; + version: number; + created_at: string; + updated_at: string; + snapshot: SnapshotData; + links: Array; +}; + +/** + * Stream citation generation event. + */ +export type StreamCitationGeneration = { + citations?: Array; +}; + +export type StreamEnd = { + response_id?: string | null; + generation_id?: string | null; + conversation_id?: string | null; + text: string; + citations?: Array; + documents?: Array; + search_results?: Array<{ + [key: string]: unknown; + }>; + search_queries?: Array; + tool_calls?: Array; + finish_reason?: string | null; + chat_history?: Array | null; + error?: string | null; +}; + +/** + * Stream Events returned by Cohere's chat stream response. + */ +export type StreamEvent = + | 'stream-start' + | 'search-queries-generation' + | 'search-results' + | 'tool-input' + | 'tool-result' + | 'text-generation' + | 'citation-generation' + | 'stream-end' + | 'non-streamed-chat-response' + | 'tool-calls-generation' + | 'tool-calls-chunk'; + +/** + * Stream query generation event. + */ +export type StreamQueryGeneration = { + query: string; +}; + +/** + * Stream queries generation event. + */ +export type StreamSearchQueriesGeneration = { + search_queries?: Array; +}; + +export type StreamSearchResults = { + search_results?: Array<{ + [key: string]: unknown; + }>; + documents?: Array; +}; + +/** + * Stream start event. + */ +export type StreamStart = { + generation_id?: string | null; + conversation_id?: string | null; +}; + +/** + * Stream text generation event. + */ +export type StreamTextGeneration = { + text: string; +}; + +export type StreamToolCallsChunk = { + tool_call_delta?: ToolCallDelta | null; + text: string | null; +}; + +/** + * Stream tool calls generation event. + */ +export type StreamToolCallsGeneration = { + tool_calls?: Array | null; + text: string | null; +}; + +export type StreamToolInput = { + input_type: ToolInputType; + tool_name: string; + input: string; + text: string; +}; + +export type StreamToolResult = { + result: unknown; + tool_name: string; + documents?: Array; +}; + +export type Tool = { + name?: string | null; + display_name?: string; + description?: string | null; + parameter_definitions?: { + [key: string]: unknown; + } | null; +}; + +export type ToolCall = { + name: string; + parameters?: { + [key: string]: unknown; + }; +}; + +export type ToolCallDelta = { + name: string | null; + index: number | null; + parameters: string | null; +}; + +/** + * Type of input passed to the tool + */ +export type ToolInputType = 'QUERY' | 'CODE'; + +export type UpdateAgent = { + name?: string | null; + version?: number | null; + description?: string | null; + preamble?: string | null; + temperature?: number | null; + model?: string | null; + deployment?: string | null; + tools?: Array | null; + tools_metadata?: Array | null; +}; + +export type UpdateAgentToolMetadata = { + id?: string | null; + tool_name?: string | null; + artifacts?: Array<{ + [key: string]: unknown; + }> | null; +}; + +export type UpdateConversation = { + title?: string | null; + description?: string | null; +}; + +export type UpdateDeploymentEnv = { + env_vars: { + [key: string]: string; + }; +}; + +export type UpdateFile = { + file_name?: string | null; + message_id?: string | null; +}; + +export type UpdateUser = { + password?: string | null; + hashed_password?: (Blob | File) | null; + fullname?: string | null; + email?: string | null; +}; + +export type UploadFile = { + id: string; + created_at: string; + updated_at: string; + user_id: string; + conversation_id: string; + file_name: string; + file_path: string; + file_size?: number; +}; + +export type User = { + fullname: string; + email?: string | null; + id: string; + created_at: string; + updated_at: string; +}; + +export type ValidationError = { + loc: Array; + msg: string; + type: string; +}; + +export type GetStrategiesV1AuthStrategiesGetResponse = Array; + +export type LoginV1LoginPostData = { + requestBody: Login; +}; + +export type LoginV1LoginPostResponse = JWTResponse | null; + +export type AuthorizeV1StrategyAuthPostData = { + code?: string; + strategy: string; +}; + +export type AuthorizeV1StrategyAuthPostResponse = JWTResponse; + +export type LogoutV1LogoutGetResponse = Logout; + +export type LoginV1ToolAuthGetResponse = unknown; + +export type ChatStreamV1ChatStreamPostData = { + agentId?: string | null; + requestBody: CohereChatRequest; +}; + +export type ChatStreamV1ChatStreamPostResponse = Array; + +export type ChatV1ChatPostData = { + agentId?: string | null; + deploymentName?: string | null; + requestBody: CohereChatRequest; +}; + +export type ChatV1ChatPostResponse = NonStreamedChatResponse; + +export type LangchainChatStreamV1LangchainChatPostData = { + requestBody: LangchainChatRequest; +}; + +export type LangchainChatStreamV1LangchainChatPostResponse = unknown; + +export type CreateUserV1UsersPostData = { + requestBody: CreateUser; +}; + +export type CreateUserV1UsersPostResponse = User; + +export type ListUsersV1UsersGetData = { + limit?: number; + offset?: number; +}; + +export type ListUsersV1UsersGetResponse = Array; + +export type GetUserV1UsersUserIdGetData = { + userId: string; +}; + +export type GetUserV1UsersUserIdGetResponse = User; + +export type UpdateUserV1UsersUserIdPutData = { + requestBody: UpdateUser; + userId: string; +}; + +export type UpdateUserV1UsersUserIdPutResponse = User; + +export type DeleteUserV1UsersUserIdDeleteData = { + userId: string; +}; + +export type DeleteUserV1UsersUserIdDeleteResponse = DeleteUser; + +export type GetConversationV1ConversationsConversationIdGetData = { + conversationId: string; +}; + +export type GetConversationV1ConversationsConversationIdGetResponse = Conversation; + +export type UpdateConversationV1ConversationsConversationIdPutData = { + conversationId: string; + requestBody: UpdateConversation; +}; + +export type UpdateConversationV1ConversationsConversationIdPutResponse = Conversation; + +export type DeleteConversationV1ConversationsConversationIdDeleteData = { + conversationId: string; +}; + +export type DeleteConversationV1ConversationsConversationIdDeleteResponse = DeleteConversation; + +export type ListConversationsV1ConversationsGetData = { + agentId?: string; + limit?: number; + offset?: number; +}; + +export type ListConversationsV1ConversationsGetResponse = Array; + +export type SearchConversationsV1ConversationsSearchGetData = { + agentId?: string; + limit?: number; + offset?: number; + query: string; +}; + +export type SearchConversationsV1ConversationsSearchGetResponse = + Array; + +export type UploadFileV1ConversationsUploadFilePostData = { + formData: Body_upload_file_v1_conversations_upload_file_post; +}; + +export type UploadFileV1ConversationsUploadFilePostResponse = UploadFile; + +export type ListFilesV1ConversationsConversationIdFilesGetData = { + conversationId: string; +}; + +export type ListFilesV1ConversationsConversationIdFilesGetResponse = Array; + +export type UpdateFileV1ConversationsConversationIdFilesFileIdPutData = { + conversationId: string; + fileId: string; + requestBody: UpdateFile; +}; + +export type UpdateFileV1ConversationsConversationIdFilesFileIdPutResponse = File; + +export type DeleteFileV1ConversationsConversationIdFilesFileIdDeleteData = { + conversationId: string; + fileId: string; +}; + +export type DeleteFileV1ConversationsConversationIdFilesFileIdDeleteResponse = DeleteFile; + +export type GenerateTitleV1ConversationsConversationIdGenerateTitlePostData = { + conversationId: string; +}; + +export type GenerateTitleV1ConversationsConversationIdGenerateTitlePostResponse = GenerateTitle; + +export type ListToolsV1ToolsGetData = { + agentId?: string | null; +}; + +export type ListToolsV1ToolsGetResponse = Array; + +export type ListDeploymentsV1DeploymentsGetData = { + all?: boolean; +}; + +export type ListDeploymentsV1DeploymentsGetResponse = Array; + +export type SetEnvVarsV1DeploymentsNameSetEnvVarsPostData = { + name: string; + requestBody: UpdateDeploymentEnv; +}; + +export type SetEnvVarsV1DeploymentsNameSetEnvVarsPostResponse = unknown; + +export type ListExperimentalFeaturesV1ExperimentalFeaturesGetResponse = unknown; + +export type CreateAgentV1AgentsPostData = { + requestBody: CreateAgent; +}; + +export type CreateAgentV1AgentsPostResponse = Agent; + +export type ListAgentsV1AgentsGetData = { + limit?: number; + offset?: number; +}; + +export type ListAgentsV1AgentsGetResponse = Array; + +export type GetAgentByIdV1AgentsAgentIdGetData = { + agentId: string; +}; + +export type GetAgentByIdV1AgentsAgentIdGetResponse = Agent; + +export type UpdateAgentV1AgentsAgentIdPutData = { + agentId: string; + requestBody: UpdateAgent; +}; + +export type UpdateAgentV1AgentsAgentIdPutResponse = Agent; + +export type DeleteAgentV1AgentsAgentIdDeleteData = { + agentId: string; +}; + +export type DeleteAgentV1AgentsAgentIdDeleteResponse = DeleteAgent; + +export type ListAgentToolMetadataV1AgentsAgentIdToolMetadataGetData = { + agentId: string; +}; + +export type ListAgentToolMetadataV1AgentsAgentIdToolMetadataGetResponse = Array; + +export type CreateAgentToolMetadataV1AgentsAgentIdToolMetadataPostData = { + agentId: string; + requestBody: CreateAgentToolMetadata; +}; + +export type CreateAgentToolMetadataV1AgentsAgentIdToolMetadataPostResponse = AgentToolMetadata; + +export type UpdateAgentToolMetadataV1AgentsAgentIdToolMetadataAgentToolMetadataIdPutData = { + agentId: string; + agentToolMetadataId: string; + requestBody: UpdateAgentToolMetadata; +}; + +export type UpdateAgentToolMetadataV1AgentsAgentIdToolMetadataAgentToolMetadataIdPutResponse = + AgentToolMetadata; + +export type DeleteAgentToolMetadataV1AgentsAgentIdToolMetadataAgentToolMetadataIdDeleteData = { + agentId: string; + agentToolMetadataId: string; +}; + +export type DeleteAgentToolMetadataV1AgentsAgentIdToolMetadataAgentToolMetadataIdDeleteResponse = + DeleteAgentToolMetadata; + +export type ListSnapshotsV1SnapshotsGetResponse = Array; + +export type CreateSnapshotV1SnapshotsPostData = { + requestBody: CreateSnapshot; +}; + +export type CreateSnapshotV1SnapshotsPostResponse = CreateSnapshotResponse; + +export type GetSnapshotV1SnapshotsLinkLinkIdGetData = { + linkId: string; +}; + +export type GetSnapshotV1SnapshotsLinkLinkIdGetResponse = Snapshot; + +export type DeleteSnapshotLinkV1SnapshotsLinkLinkIdDeleteData = { + linkId: string; +}; + +export type DeleteSnapshotLinkV1SnapshotsLinkLinkIdDeleteResponse = unknown; + +export type DeleteSnapshotV1SnapshotsSnapshotIdDeleteData = { + snapshotId: string; +}; + +export type DeleteSnapshotV1SnapshotsSnapshotIdDeleteResponse = unknown; + +export type HealthHealthGetResponse = unknown; + +export type ApplyMigrationsMigratePostResponse = unknown; + +export type $OpenApiTs = { + '/v1/auth_strategies': { + get: { + res: { + /** + * Successful Response + */ + 200: Array; + }; + }; + }; + '/v1/login': { + post: { + req: { + requestBody: Login; + }; + res: { + /** + * Successful Response + */ + 200: JWTResponse | null; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/{strategy}/auth': { + post: { + req: { + code?: string; + strategy: string; + }; + res: { + /** + * Successful Response + */ + 200: JWTResponse; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/logout': { + get: { + res: { + /** + * Successful Response + */ + 200: Logout; + }; + }; + }; + '/v1/tool/auth': { + get: { + res: { + /** + * Successful Response + */ + 200: unknown; + }; + }; + }; + '/v1/chat-stream': { + post: { + req: { + agentId?: string | null; + requestBody: CohereChatRequest; + }; + res: { + /** + * Successful Response + */ + 200: Array; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/chat': { + post: { + req: { + agentId?: string | null; + deploymentName?: string | null; + requestBody: CohereChatRequest; + }; + res: { + /** + * Successful Response + */ + 200: NonStreamedChatResponse; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/langchain-chat': { + post: { + req: { + requestBody: LangchainChatRequest; + }; + res: { + /** + * Successful Response + */ + 200: unknown; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/users': { + post: { + req: { + requestBody: CreateUser; + }; + res: { + /** + * Successful Response + */ + 200: User; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + get: { + req: { + limit?: number; + offset?: number; + }; + res: { + /** + * Successful Response + */ + 200: Array; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/users/{user_id}': { + get: { + req: { + userId: string; + }; + res: { + /** + * Successful Response + */ + 200: User; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + put: { + req: { + requestBody: UpdateUser; + userId: string; + }; + res: { + /** + * Successful Response + */ + 200: User; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + delete: { + req: { + userId: string; + }; + res: { + /** + * Successful Response + */ + 200: DeleteUser; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/conversations/{conversation_id}': { + get: { + req: { + conversationId: string; + }; + res: { + /** + * Successful Response + */ + 200: Conversation; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + put: { + req: { + conversationId: string; + requestBody: UpdateConversation; + }; + res: { + /** + * Successful Response + */ + 200: Conversation; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + delete: { + req: { + conversationId: string; + }; + res: { + /** + * Successful Response + */ + 200: DeleteConversation; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/conversations': { + get: { + req: { + agentId?: string; + limit?: number; + offset?: number; + }; + res: { + /** + * Successful Response + */ + 200: Array; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/conversations:search': { + get: { + req: { + agentId?: string; + limit?: number; + offset?: number; + query: string; + }; + res: { + /** + * Successful Response + */ + 200: Array; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/conversations/upload_file': { + post: { + req: { + formData: Body_upload_file_v1_conversations_upload_file_post; + }; + res: { + /** + * Successful Response + */ + 200: UploadFile; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/conversations/{conversation_id}/files': { + get: { + req: { + conversationId: string; + }; + res: { + /** + * Successful Response + */ + 200: Array; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/conversations/{conversation_id}/files/{file_id}': { + put: { + req: { + conversationId: string; + fileId: string; + requestBody: UpdateFile; + }; + res: { + /** + * Successful Response + */ + 200: File; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + delete: { + req: { + conversationId: string; + fileId: string; + }; + res: { + /** + * Successful Response + */ + 200: DeleteFile; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/conversations/{conversation_id}/generate-title': { + post: { + req: { + conversationId: string; + }; + res: { + /** + * Successful Response + */ + 200: GenerateTitle; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/tools': { + get: { + req: { + agentId?: string | null; + }; + res: { + /** + * Successful Response + */ + 200: Array; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/deployments': { + get: { + req: { + all?: boolean; + }; + res: { + /** + * Successful Response + */ + 200: Array; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/deployments/{name}/set_env_vars': { + post: { + req: { + name: string; + requestBody: UpdateDeploymentEnv; + }; + res: { + /** + * Successful Response + */ + 200: unknown; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/experimental_features/': { + get: { + res: { + /** + * Successful Response + */ + 200: unknown; + }; + }; + }; + '/v1/agents': { + post: { + req: { + requestBody: CreateAgent; + }; + res: { + /** + * Successful Response + */ + 200: Agent; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + get: { + req: { + limit?: number; + offset?: number; + }; + res: { + /** + * Successful Response + */ + 200: Array; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/agents/{agent_id}': { + get: { + req: { + agentId: string; + }; + res: { + /** + * Successful Response + */ + 200: Agent; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + put: { + req: { + agentId: string; + requestBody: UpdateAgent; + }; + res: { + /** + * Successful Response + */ + 200: Agent; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + delete: { + req: { + agentId: string; + }; + res: { + /** + * Successful Response + */ + 200: DeleteAgent; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/agents/{agent_id}/tool-metadata': { + get: { + req: { + agentId: string; + }; + res: { + /** + * Successful Response + */ + 200: Array; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + post: { + req: { + agentId: string; + requestBody: CreateAgentToolMetadata; + }; + res: { + /** + * Successful Response + */ + 200: AgentToolMetadata; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/agents/{agent_id}/tool-metadata/{agent_tool_metadata_id}': { + put: { + req: { + agentId: string; + agentToolMetadataId: string; + requestBody: UpdateAgentToolMetadata; + }; + res: { + /** + * Successful Response + */ + 200: AgentToolMetadata; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + delete: { + req: { + agentId: string; + agentToolMetadataId: string; + }; + res: { + /** + * Successful Response + */ + 200: DeleteAgentToolMetadata; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/snapshots': { + get: { + res: { + /** + * Successful Response + */ + 200: Array; + }; + }; + post: { + req: { + requestBody: CreateSnapshot; + }; + res: { + /** + * Successful Response + */ + 200: CreateSnapshotResponse; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/snapshots/link/{link_id}': { + get: { + req: { + linkId: string; + }; + res: { + /** + * Successful Response + */ + 200: Snapshot; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + delete: { + req: { + linkId: string; + }; + res: { + /** + * Successful Response + */ + 200: unknown; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/v1/snapshots/{snapshot_id}': { + delete: { + req: { + snapshotId: string; + }; + res: { + /** + * Successful Response + */ + 200: unknown; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; + '/health': { + get: { + res: { + /** + * Successful Response + */ + 200: unknown; + }; + }; + }; + '/migrate': { + post: { + res: { + /** + * Successful Response + */ + 200: unknown; + }; + }; + }; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/index.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..2a66bb706eaa2e0ecb5ac44135d3932fa9f664bb --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/cohere-client/index.ts @@ -0,0 +1,5 @@ +import { OpenAPI, ToolkitClient } from './generated'; + +export * from './generated/index'; + +export const client = new ToolkitClient(OpenAPI); diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/commandHelp.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/commandHelp.ts new file mode 100644 index 0000000000000000000000000000000000000000..8399cebc08d703101420fb6bf1d5d21ee52a4284 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/commandHelp.ts @@ -0,0 +1,20 @@ +import { Middleware, SlackCommandMiddlewareArgs } from '@slack/bolt'; + +import { HELP_MESSAGE } from '../constants'; +import { getEphemeralBlocks } from '../utils/getMessageBlocks'; + +/** + * Help command to show the user how to use the bot + * Discusses the following: + * - What the bot can do + * - What commands are available to the user + * - What context menu options are available to the user + */ +export const commandHelp: Middleware = async ({ ack, respond }) => { + await ack(); + await respond({ + response_type: 'ephemeral', + text: HELP_MESSAGE, + blocks: getEphemeralBlocks({ text: HELP_MESSAGE }), + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/index.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..9f17d8e499c2538b2c6369ee8712c53d8111fbac --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/index.ts @@ -0,0 +1,13 @@ +export * from './commandHelp'; +export * from './setTools'; +export * from './setModel'; +export * from './setDeployment'; +export * from './setPreamble'; +export * from './setTemperature'; +export * from './setupCommand'; +export * from './summarize'; +export * from './viewTools'; +export * from './viewDeployment'; +export * from './viewModel'; +export * from './viewPreamble'; +export * from './viewTemperature'; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/setDeployment.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/setDeployment.ts new file mode 100644 index 0000000000000000000000000000000000000000..848da3497953fabaa8383b869740a3333db2e204 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/setDeployment.ts @@ -0,0 +1,56 @@ +import { Middleware, SlackCommandMiddlewareArgs } from '@slack/bolt'; + +import { prisma } from '..'; +import { ALERTS } from '../constants'; +import { getEphemeralBlocks } from '../utils/getMessageBlocks'; + +// Channel Model Commands +export const setDeployment: Middleware = async ({ + context, + ack, + respond, + command, +}) => { + await ack(); + + const channelId = command.channel_id; + const channelName = command.channel_name; + + const deployment = command.text || null; + const workspaceSettings = await prisma.workspaceSettings.upsert({ + create: { teamId: context.teamId, enterpriseId: context.enterpriseId }, + update: {}, + where: { teamId: context.teamId, enterpriseId: context.enterpriseId }, + }); + + await prisma.channelSettings.upsert({ + create: { + channelId, + workspaceId: workspaceSettings.id, + deployment, + }, + update: { deployment }, + where: { + channelSettingsId: { + channelId, + workspaceId: workspaceSettings.id, + }, + }, + }); + + if (command.channel_name === 'directmessage') { + await respond({ + response_type: 'ephemeral', + text: ALERTS.channelDeploymentSet(channelName, deployment), + blocks: getEphemeralBlocks({ + text: ALERTS.channelDeploymentSet(channelName, deployment), + }), + }); + return; + } + + await respond({ + response_type: 'in_channel', + text: ALERTS.channelDeploymentSet(channelName, deployment, command.user_id), + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/setModel.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/setModel.ts new file mode 100644 index 0000000000000000000000000000000000000000..629cf188ccd7b93f19aac6c43c8130dd1f28e236 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/setModel.ts @@ -0,0 +1,56 @@ +import { Middleware, SlackCommandMiddlewareArgs } from '@slack/bolt'; + +import { prisma } from '..'; +import { ALERTS } from '../constants'; +import { getEphemeralBlocks } from '../utils/getMessageBlocks'; + +// Channel Model Commands +export const setModel: Middleware = async ({ + context, + ack, + respond, + command, +}) => { + await ack(); + + const channelId = command.channel_id; + const channelName = command.channel_name; + + const modelName = command.text || null; + const workspaceSettings = await prisma.workspaceSettings.upsert({ + create: { teamId: context.teamId, enterpriseId: context.enterpriseId }, + update: {}, + where: { teamId: context.teamId, enterpriseId: context.enterpriseId }, + }); + + await prisma.channelSettings.upsert({ + create: { + channelId, + workspaceId: workspaceSettings.id, + modelName, + }, + update: { modelName }, + where: { + channelSettingsId: { + channelId, + workspaceId: workspaceSettings.id, + }, + }, + }); + + if (command.channel_name === 'directmessage') { + await respond({ + response_type: 'ephemeral', + text: ALERTS.channelModelSet(channelName, modelName), + blocks: getEphemeralBlocks({ + text: ALERTS.channelModelSet(channelName, modelName), + }), + }); + return; + } + + await respond({ + response_type: 'in_channel', + text: ALERTS.channelModelSet(channelName, modelName, command.user_id), + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/setPreamble.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/setPreamble.ts new file mode 100644 index 0000000000000000000000000000000000000000..d5bdcf9d96a353430ddbce83971c8b3a6e675574 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/setPreamble.ts @@ -0,0 +1,58 @@ +import { Middleware, SlackCommandMiddlewareArgs } from '@slack/bolt'; + +import { prisma } from '..'; +import { ALERTS } from '../constants'; +import { getEphemeralBlocks } from '../utils/getMessageBlocks'; + +// Preamble Override Commands + +export const setPreamble: Middleware = async ({ + context, + ack, + respond, + command, +}) => { + await ack(); + + const channelId = command.channel_id; + const channelName = command.channel_name; + + const preambleOverride = command.text == '' ? null : command.text; + + const workspaceSettings = await prisma.workspaceSettings.upsert({ + create: { teamId: context.teamId, enterpriseId: context.enterpriseId }, + update: {}, + where: { teamId: context.teamId, enterpriseId: context.enterpriseId }, + }); + + await prisma.channelSettings.upsert({ + create: { + channelId, + workspaceId: workspaceSettings.id, + preamble: preambleOverride, + }, + update: { preamble: preambleOverride }, + where: { + channelSettingsId: { + channelId, + workspaceId: workspaceSettings.id, + }, + }, + }); + + if (command.channel_name === 'directmessage') { + await respond({ + response_type: 'ephemeral', + text: ALERTS.channelPreambleOverrideSet(channelName, preambleOverride), + blocks: getEphemeralBlocks({ + text: ALERTS.channelPreambleOverrideSet(channelName, preambleOverride), + }), + }); + return; + } + + await respond({ + response_type: 'in_channel', + text: ALERTS.channelPreambleOverrideSet(channelName, preambleOverride, command.user_id), + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/setTemperature.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/setTemperature.ts new file mode 100644 index 0000000000000000000000000000000000000000..d9669f0c1f70976e824a5b2c86800e0a77119e82 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/setTemperature.ts @@ -0,0 +1,70 @@ +import { Middleware, SlackCommandMiddlewareArgs } from '@slack/bolt'; + +import { prisma } from '..'; +import { ALERTS, DEFAULT_CHAT_TEMPERATURE, ERRORS } from '../constants'; +import { handleError } from '../handlers'; +import { getEphemeralBlocks } from '../utils/getMessageBlocks'; + +// Channel Temperature Commands +export const setTemperature: Middleware = async ({ + client, + context, + ack, + respond, + command, +}) => { + await ack(); + + const channelId = command.channel_id; + const channelName = command.channel_name; + + const temperature = command.text ? Number(command.text) : DEFAULT_CHAT_TEMPERATURE; + + if (isNaN(temperature) || temperature < 0 || temperature > 5) { + await handleError({ + client, + userId: command.user_id, + replyChannelId: channelId, + replyThreadTs: command.thread_ts, + customErrorMsg: ERRORS.INVALID_TEMPERATURE, + }); + return; + } + + const workspaceSettings = await prisma.workspaceSettings.upsert({ + create: { teamId: context.teamId, enterpriseId: context.enterpriseId }, + update: {}, + where: { teamId: context.teamId, enterpriseId: context.enterpriseId }, + }); + + await prisma.channelSettings.upsert({ + create: { + channelId, + workspaceId: workspaceSettings.id, + temperature, + }, + update: { temperature }, + where: { + channelSettingsId: { + channelId, + workspaceId: workspaceSettings.id, + }, + }, + }); + + if (command.channel_name === 'directmessage') { + await respond({ + response_type: 'ephemeral', + text: ALERTS.channelTemperatureSet(channelName, temperature), + blocks: getEphemeralBlocks({ + text: ALERTS.channelTemperatureSet(channelName, temperature), + }), + }); + return; + } + + await respond({ + response_type: 'in_channel', + text: ALERTS.channelTemperatureSet(channelName, temperature, command.user_id), + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/setTools.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/setTools.ts new file mode 100644 index 0000000000000000000000000000000000000000..75a18f0ba9310c80eeca93098c839934aaf18452 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/setTools.ts @@ -0,0 +1,170 @@ +import { KnownBlock, Middleware, MrkdwnOption, SlackCommandMiddlewareArgs } from '@slack/bolt'; + +import { ApiError, OpenAPI, ToolkitClient } from '../cohere-client'; +import { ERRORS } from '../constants'; +import { handleError } from '../handlers'; +import { getChannelSettings } from '../utils/getChannelSettings'; + +// Tools list command, brings up a modal for user to select tools +export const setTools: Middleware = async ({ + client, + ack, + respond, + command, + context, + body, +}) => { + await ack(); + + const channelId = command.channel_id; + const basicErrorHandlerArgs = { + client, + userId: command.user_id, + replyChannelId: command.channel_id, + }; + + const { tools: preEnabledToolsList } = await getChannelSettings({ + teamId: context.teamId, + enterpriseId: context.enterpriseId, + channelId, + }); + + const getToolsListFromAPI = async () => { + try { + const toolkitClient = new ToolkitClient(OpenAPI); + const tools = await toolkitClient.default.listToolsV1ToolsGet(); + + return tools.filter((t) => t.is_available).map((tool) => tool.name); + } catch (error: any) { + console.error(error); + let customErrorMsg = ERRORS.GENERAL; + if (error instanceof ApiError) { + customErrorMsg = error.message; + } + await handleError({ + customErrorMsg: `${ERRORS.PREFIX} ${customErrorMsg}`, + ...basicErrorHandlerArgs, + }); + return; + } + }; + + const apiToolsList = await getToolsListFromAPI(); + + if (!apiToolsList) { + await respond({ + response_type: 'ephemeral', + text: `No tools are available in your account.`, + }); + return; + } + + const preEnabledToolsSet = new Set(preEnabledToolsList.map((t) => t.name)); + const formattedPreEnabledToolsList = apiToolsList.reduce((acc, tool) => { + if (tool && preEnabledToolsSet.has(tool)) { + acc.push({ + text: { type: 'mrkdwn', text: tool }, + value: tool, + }); + } + return acc; + }, []); + + // Remove pre-enabled tools from the list of available tools so we can + // Display those in a diff checkbox list + const formattedAndSanitizedApiToolsList = apiToolsList.reduce((acc, tool) => { + if (tool && !preEnabledToolsSet.has(tool)) { + acc.push({ + text: { type: 'mrkdwn', text: tool }, + value: tool, + }); + } + return acc; + }, []); + + // Slack only allows 1 - 10 options per checkbox block, so we need to group the tools + let groupedTools = []; + for (let i = 0; i < formattedAndSanitizedApiToolsList.length; i += 10) { + const miniGroup = formattedAndSanitizedApiToolsList.slice(i, i + 10); + groupedTools.push(miniGroup); + } + + const formatterGroupedTools = groupedTools.map((group, index) => { + return { + block_id: `tools_list_block_${index}`, + type: 'input', + optional: true, + element: { + type: 'checkboxes', + options: group, + action_id: 'checkbox_action', + }, + label: { + type: 'plain_text', + text: + groupedTools.length > 1 + ? `Available Tools ${index + 1}/${groupedTools.length}` + : 'Available Tools', + emoji: true, + }, + }; + }); + + const blocks = [ + formattedPreEnabledToolsList.length > 0 && { + block_id: 'enabled_tools_list_block', + type: 'input', + optional: true, + element: { + type: 'checkboxes', + options: formattedPreEnabledToolsList, + initial_options: formattedPreEnabledToolsList, + action_id: 'checkbox_action', + }, + label: { + type: 'plain_text', + text: 'Enabled Tools', + emoji: true, + }, + }, + ...formatterGroupedTools, + ].filter((n) => n) as KnownBlock[]; + + await client.views + .open({ + trigger_id: body.trigger_id, + view: { + private_metadata: JSON.stringify({ + channelId, + numOfGroups: groupedTools.length, + hasPreEnabledTools: formattedPreEnabledToolsList.length > 0, + }), + callback_id: 'tools_view', + title: { + type: 'plain_text', + text: 'Tools Setup 🖇️', + emoji: true, + }, + blocks, + submit: { + type: 'plain_text', + text: 'Submit', + emoji: true, + }, + type: 'modal', + close: { + type: 'plain_text', + text: 'Cancel', + emoji: true, + }, + }, + }) + .catch( + async (error) => + await handleError({ + ...basicErrorHandlerArgs, + replyThreadTs: command.thread_ts, + customErrorMsg: error, + }), + ); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/setupCommand.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/setupCommand.ts new file mode 100644 index 0000000000000000000000000000000000000000..b014ccc8d5ca88c1cf924b29484028d35cfef3c4 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/setupCommand.ts @@ -0,0 +1,91 @@ +import { KnownBlock, Middleware, SlackCommandMiddlewareArgs } from '@slack/bolt'; + +import { prisma } from '..'; +import { ALERTS } from '../constants'; +import { handleError } from '../handlers'; + +// API Key Commands, brings up a modal for user to input api key +export const setupCommand: Middleware = async ({ + client, + ack, + respond, + command, + context, + body, +}) => { + await ack(); + + const userInfo = await client.users.info({ user: command.user_id }); + const userIsAdmin = userInfo.user ? userInfo.user.is_admin || userInfo.user.is_owner : false; + + await prisma.workspaceSettings.upsert({ + create: { teamId: context.teamId, enterpriseId: context.enterpriseId }, + update: {}, + where: { teamId: context.teamId, enterpriseId: context.enterpriseId }, + }); + + if (!userIsAdmin && process.env.NODE_ENV !== 'development') { + await respond({ + response_type: 'ephemeral', + text: ALERTS.NOT_ADMIN, + }); + return; + } + + const blocks = [ + { + type: 'section', + block_id: 'intro_block', + text: { + type: 'mrkdwn', + text: "Hello! 👋 Let's get Command setup!", + }, + }, + { + type: 'section', + block_id: 'legal_block', + text: { + type: 'mrkdwn', + text: "By submitting this form, you agree to Cohere's , and .", + }, + }, + ].filter((n) => n) as KnownBlock[]; // Remove nulls and undefineds + + const channelId = command.channel_id; + await client.views + .open({ + trigger_id: body.trigger_id, + view: { + callback_id: 'api_view', + // Pass whether the user is an admin to avoid duplicate DB calls + private_metadata: JSON.stringify({ userIsAdmin }), + title: { + type: 'plain_text', + text: 'Command Setup', + emoji: true, + }, + submit: { + type: 'plain_text', + text: 'Submit', + emoji: true, + }, + type: 'modal', + close: { + type: 'plain_text', + text: 'Cancel', + emoji: true, + }, + blocks, + }, + }) + .catch( + async (error) => + await handleError({ + client, + userId: command.user_id, + replyChannelId: channelId, + replyThreadTs: command.thread_ts, + customErrorMsg: error, + }), + ); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/summarize.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/summarize.ts new file mode 100644 index 0000000000000000000000000000000000000000..29c63c42d14cb378b7afb2b36a470b1fdc2c5deb --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/summarize.ts @@ -0,0 +1,62 @@ +import { Middleware, SlackCommandMiddlewareArgs } from '@slack/bolt'; + +import { ALERTS } from '../constants'; +import { handleError, handleSummarizeThread } from '../handlers'; +import { getChannelSettings } from '../utils/getChannelSettings'; + +/** + * This slash command can be used in dms, groups and channels to + * get a summary of a thread given a link + */ +export const summarize: Middleware = async ({ + ack, + respond, + command, + client, + context, +}) => { + await ack(); + /** + * Extracts the thread channel id and thread time-stamp from the link + * channel -> C02L95WDEKA + * thread_ts -> p1675178802502139 -> 1675178802.502139 + */ + const threadChannelId = command.text.match(/(C|D)\w{10}/g)?.[0]; + + const unformattedTs = command.text.match(/p\d{16}/g)?.[0]; + // Thread TS always has 6 numbers after the decimal; The number of numbers before the decimal varies + const threadTs = unformattedTs?.replace(/(\d+)(\d{6})/g, '$1.$2'); + const userId = command.user_id; + const channelId = command.channel_id; + const teamId = context.teamId; + const enterpriseId = context.enterpriseId; + + // Not an valid slack thread link + if (!threadChannelId || !threadTs) { + await handleError({ + client, + customErrorMsg: ALERTS.NOT_SLACK_THREAD_LINK, + userId, + replyChannelId: channelId, + includeUserIdInMsg: false, + }); + return; + } + const { deployment, model, temperature, preambleOverride } = await getChannelSettings({ + teamId, + enterpriseId, + channelId, + }); + + await handleSummarizeThread({ + context, + client, + threadChannelId, + userId, + threadTs, + say: respond, + currentChannelId: channelId, + deployment, + model, + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/viewDeployment.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/viewDeployment.ts new file mode 100644 index 0000000000000000000000000000000000000000..3014bd2106dabba8578808e44e9f0c26a4150500 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/viewDeployment.ts @@ -0,0 +1,29 @@ +import { Middleware, SlackCommandMiddlewareArgs } from '@slack/bolt'; + +import { ALERTS } from '../constants'; +import { getChannelSettings } from '../utils/getChannelSettings'; +import { getEphemeralBlocks } from '../utils/getMessageBlocks'; + +export const viewDeployment: Middleware = async ({ + context, + ack, + respond, + command, +}) => { + await ack(); + + const channelId = command.channel_id; + const channelName = command.channel_name; + + const { deployment } = await getChannelSettings({ + teamId: context.teamId, + enterpriseId: context.enterpriseId, + channelId, + }); + + await respond({ + response_type: 'ephemeral', + text: ALERTS.channelDeploymentView(channelName, deployment), + blocks: getEphemeralBlocks({ text: ALERTS.channelDeploymentView(channelName, deployment) }), + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/viewModel.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/viewModel.ts new file mode 100644 index 0000000000000000000000000000000000000000..dbe2055bee8eda88f35e692c875893d5ade46e16 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/viewModel.ts @@ -0,0 +1,29 @@ +import { Middleware, SlackCommandMiddlewareArgs } from '@slack/bolt'; + +import { ALERTS } from '../constants'; +import { getChannelSettings } from '../utils/getChannelSettings'; +import { getEphemeralBlocks } from '../utils/getMessageBlocks'; + +export const viewModel: Middleware = async ({ + context, + ack, + respond, + command, +}) => { + await ack(); + + const channelId = command.channel_id; + const channelName = command.channel_name; + + const { model } = await getChannelSettings({ + teamId: context.teamId, + enterpriseId: context.enterpriseId, + channelId, + }); + + await respond({ + response_type: 'ephemeral', + text: ALERTS.channelModelView(channelName, model), + blocks: getEphemeralBlocks({ text: ALERTS.channelModelView(channelName, model) }), + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/viewPreamble.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/viewPreamble.ts new file mode 100644 index 0000000000000000000000000000000000000000..68d80edb3b6baecd9ab406f5072fcf474ce93f84 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/viewPreamble.ts @@ -0,0 +1,31 @@ +import { Middleware, SlackCommandMiddlewareArgs } from '@slack/bolt'; + +import { ALERTS } from '../constants'; +import { getChannelSettings } from '../utils/getChannelSettings'; +import { getEphemeralBlocks } from '../utils/getMessageBlocks'; + +export const viewPreamble: Middleware = async ({ + context, + ack, + respond, + command, +}) => { + await ack(); + + const channelId = command.channel_id; + const channelName = command.channel_name; + + const { preambleOverride } = await getChannelSettings({ + teamId: context.teamId, + enterpriseId: context.enterpriseId, + channelId, + }); + + await respond({ + response_type: 'ephemeral', + text: ALERTS.channelPreambleOverrideView(channelName, preambleOverride), + blocks: getEphemeralBlocks({ + text: ALERTS.channelPreambleOverrideView(channelName, preambleOverride), + }), + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/viewTemperature.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/viewTemperature.ts new file mode 100644 index 0000000000000000000000000000000000000000..417693710c70d7948b0fc1401389c4fb254fb587 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/viewTemperature.ts @@ -0,0 +1,33 @@ +import { Middleware, SlackCommandMiddlewareArgs } from '@slack/bolt'; + +import { ALERTS, DEFAULT_CHAT_TEMPERATURE } from '../constants'; +import { getChannelSettings } from '../utils/getChannelSettings'; +import { getEphemeralBlocks } from '../utils/getMessageBlocks'; + +export const viewTemperature: Middleware = async ({ + context, + ack, + respond, + command, +}) => { + await ack(); + + const channelId = command.channel_id; + const channelName = command.channel_name; + + let { temperature } = await getChannelSettings({ + teamId: context.teamId, + enterpriseId: context.enterpriseId, + channelId, + }); + + temperature = temperature || DEFAULT_CHAT_TEMPERATURE; + + await respond({ + response_type: 'ephemeral', + text: ALERTS.channelTemperatureView(channelName, temperature), + blocks: getEphemeralBlocks({ + text: ALERTS.channelTemperatureView(channelName, temperature), + }), + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/viewTools.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/viewTools.ts new file mode 100644 index 0000000000000000000000000000000000000000..95f6d862ba75529f438d7f8be5893761bd822885 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/commands/viewTools.ts @@ -0,0 +1,80 @@ +import { Middleware, SlackCommandMiddlewareArgs } from '@slack/bolt'; +import { getChannelSettings } from 'src/utils/getChannelSettings'; + +import { ApiError, OpenAPI, ToolkitClient } from '../cohere-client'; +import { ERRORS } from '../constants'; +import { handleError } from '../handlers'; +import { getEphemeralBlocks } from '../utils/getMessageBlocks'; + +// Shows users the tools enabled for a channel or all tools available +export const viewTools: Middleware = async ({ + ack, + client, + context, + command, + respond, +}) => { + await ack(); + + const basicErrorHandlerArgs = { + client, + userId: command.user_id, + replyChannelId: command.channel_id, + }; + + //can be all or channel, defaults to channel + const toolsToList = command.text === 'all' ? 'all' : 'channel'; + + if (toolsToList === 'channel') { + const channelId = command.channel_id; + + const { tools } = await getChannelSettings({ + teamId: context.teamId, + enterpriseId: context.enterpriseId, + channelId, + }); + + const toolsMessage = + tools.length > 0 + ? `Here are the tools enabled for this channel: \n${tools + .map((t) => `• ${t.name}`) + .join('\n')}` + : 'No tools have been enabled for this channel. \nYou can set tools using the command `/set-tools`'; + + await respond({ + response_type: 'ephemeral', + text: toolsMessage, + blocks: getEphemeralBlocks({ text: toolsMessage }), + }); + return; + } + + try { + const toolkitClient = new ToolkitClient(OpenAPI); + const tools = await toolkitClient.default.listToolsV1ToolsGet(); + // only show active tools that do not use oauth + const toolList = tools + .filter((tool) => tool.is_available) + .map((tool) => `• ${tool.name}`) + .join('\n'); + + await respond({ + response_type: 'ephemeral', + text: `Here are all the tools available to you:\n\n${toolList}`, + blocks: getEphemeralBlocks({ + text: `Here are all the tools available to you:\n\n${toolList}`, + }), + }); + } catch (error: any) { + console.error(error); + let customErrorMsg = ERRORS.GENERAL; + if (error instanceof ApiError) { + customErrorMsg = error.message; + } + await handleError({ + customErrorMsg: `${ERRORS.PREFIX} ${customErrorMsg}`, + ...basicErrorHandlerArgs, + }); + return; + } +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/constants.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/constants.ts new file mode 100644 index 0000000000000000000000000000000000000000..b20b4cd39db1b833277845bbff9a7f09f1ab0aec --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/constants.ts @@ -0,0 +1,159 @@ +import { Action } from './utils/actions'; + +export const COMMAND_SUFFIX = process.env.COMMAND_SUFFIX || ''; + +// todo: change to follow the format of the other envs above +export const DEFAULT_CHAT_TEMPERATURE = 0.3; + +export const PENDING_MESSAGES: { [key in Action['type']]: string } = { + chat: '_Typing..._', + 'file-invalid': '_Typing..._', + 'file-summarize': '_Summarizing file..._', + 'file-rag': '_Reading file..._', + 'chat-rag': '_Deep diving..._', + ignore: 'Unsupported action', +}; +export const ALERTS = { + THREAD_SUMMARY_PREFIX: `*:page_facing_up: Here's a summary of the thread:*`, + FILE_SUMMARY_PREFIX: `*:page_facing_up: Here's a summary of the file:*`, + RAG_SOURCES_PREFIX: '*Sources:*', + MODEL_NOT_IN_DM: + 'The `/set-model` command can only be used in a DM conversation between you and Command.', + SUMMARIZE_COMMAND_REGISTERED: 'Working on a summary! :memo:', + SHORTCUT_NOT_IN_THREAD: 'This shortcut can only be used in threads.', + NOT_SLACK_THREAD_LINK: + `Whoops, that doesn't appear to be a slack thread link. Check out the guide below to learn how to copy thread links: ` + + ``, + TYPING: '_Typing..._', + MODEL_PREFIX: '*Model:*', + NOT_ADMIN: `Sorry, Command can only be set up by a workspace admin. If you would like to set up Command, please contact them.`, + channelModelSet: (channelName: string, modelName: string | null, userId?: string) => + `All messages ${ + channelName !== 'directmessage' ? `in ${channelName} ` : '' + }will now be processed with the \`${modelName ? modelName : 'default'}\` model.${ + userId ? ` Set by <@${userId}>.` : '' + }`, + channelDeploymentSet: (channelName: string, deploymentName: string | null, userId?: string) => + `All messages ${ + channelName !== 'directmessage' ? `in ${channelName} ` : '' + }will now be processed with the \`${deploymentName ? deploymentName : DEPLOYMENT_COHERE_PLATFORM}\` model deployment.${ + userId ? ` Set by <@${userId}>.` : '' + }`, + channelDeploymentView: (channelName: string, deploymentName: string | null) => + `All messages ${ + channelName !== 'directmessage' ? `in ${channelName} ` : '' + }are currently being processed with the \`${deploymentName ? deploymentName : DEPLOYMENT_COHERE_PLATFORM}\` deployment.`, + channelModelView: (channelName: string, modelName: string | null) => + `All messages ${ + channelName !== 'directmessage' ? `in ${channelName} ` : '' + }are currently being processed with the \`${modelName ? modelName : 'default'}\` model.`, + PROMPT_TOO_LONG: + 'Due to the length of your prompt, some information may be left out. Reducing your prompt to below 4000 characters may produce better results.', + channelTemperatureSet: (channelName: string, temperature: number, userId?: string) => + `All messages ${ + channelName !== 'directmessage' ? `in ${channelName} ` : '' + }will now be processed with a temperature of \`${temperature}\`.${ + userId ? ` Set by <@${userId}>.` : '' + }`, + channelTemperatureView: (channelName: string, temperature: number) => + `All messages ${ + channelName !== 'directmessage' ? `in ${channelName} ` : '' + }are currently being processed with a temperature of \`${temperature}\`.`, + channelPreambleOverrideSet: ( + channelName: string, + preambleOverride: string | null, + userId?: string, + ) => + `All messages ${ + channelName !== 'directmessage' ? `in ${channelName} ` : '' + }will now be processed with the following preamble override:\n\`\`\`\n${ + preambleOverride || '' + }\n\`\`\`\n${userId ? `Set by <@${userId}>.` : ''}`, + channelPreambleOverrideView: (channelName: string, preambleOverride: string | null) => + `All messages ${ + channelName !== 'directmessage' ? `in ${channelName} ` : '' + }are currently being processed with the following preamble override:\n\`\`\`\n${ + preambleOverride || '' + }\n\`\`\``, + installMessage: (type: 'create' | 'update') => + type === 'create' + ? `Hi! Thank's for having me here!` + + `\nIf you're an admin/owner, you can get me setup for the Slack workspace using the \`/setup-command\` command.` + + ` If you're not an admin — please ping an admin/owner to let them know!` + : `Hi! Let's get a conversation going! Tag me in a message using \`@Command\` to get started!` + + `\nTo learn more about me, use the \`/command-help\` command.`, +}; +export const MAX_PROMPT_LENGTH = 4000; +export const PROMPTS = { + summarizeFile: (fileText: string) => + `Summarize the following text extracted from a file:\n${fileText}`, + summarizeThread: (conversationHistory: string) => + `Summarize the following conversation history:\n${conversationHistory}`, +}; +export const ERRORS = { + PREFIX: 'Whoops,', + GENERAL: 'There was an error. Please try again.', + CHAT: 'There was an error getting a reply. Please adjust your prompt according to our and try again.', + SUMMARIZE: 'There was an error getting your summary. Please try again.', + SUMMARIZE_CHAR_LIMIT: + ":confused: There's not enough conversation history to summarize. Please provide more than 500 characters.", + INVALID_SUMMARIZE_FILE_TYPE: `Sorry, I can't summarize that file type. I can summarize PDFs, Word documents (doc and docx), and text files.`, + INVALID_RAG_CHAT_FILE_TYPE: `Sorry, I can't read that file type. Currently I can only read PDFs.`, + INVALID_TEMPERATURE: + 'The value you provided is not a valid temperature (0.0-5.0). Please try again.', + USER_NOT_IN_CHANNEL: + 'Looks like the conversation linked is from a private channel. Summaries can only be generated for public channels or private channels you are a member of.', +}; +export const SLACK_API_ERRORS: { [key: string]: string } = { + not_in_channel: + "Looks like I'm not in the channel you specified. Please invite me to the channel and try again.", + channel_not_found: + "Looks like I cannot find the channel you specified. If it's a private channel, please invite me to the channel and try again.", + thread_not_found: 'Oops, I cannot find the thread you specified.', + access_denied: 'Sorry, I do not have the required access permissions.', +}; +export const STOP_REPLYING_MESSAGE = 'I will stop responding :speak_no_evil:'; +export const HELP_MESSAGE = `Hi! I'm Command, Cohere's conversational AI in Slack! :wave: + +You can chat with me to learn new subjects through open and engaging conversations. You can also summarize a thread that you missed out on with a built in shortcut. + + +\`\`\`Slash Commands\`\`\` + +*:orange_book: Feature and help commands*: + +\`/command-help\` - Show this help message +\`/summarize [thread link]\` - Post a summary of a slack thread given a link + +*:gear: Configuration commands*: + +\`/set-model [model name]\` - Set the model used for a specific channel +\`/set-deployment [deployment name]\` - Set the deployment used for a specific channel +\`/view-deployment\` - View the deployment used for a specific channel +\`/view-model\` - View the model used for a specific channel +\`/set-temperature [0.0 - 5.0]\` - Set the temperature used for a specific channel +\`/view-temperature\` - View the temperature used for a specific channel +\`/set-preamble [preamble]\` - Set the preamble override used for a specific channel +\`/view-preamble\` - View the preamble override used for a specific channel +\`/set-tools\` - Set tools for a specific channel +\`/view-tools [all]\` - View all tools available in your Cohere account or tools enabled for a specific channel +\`/setup-command\` - _Admins only_ - Setup Command for the workspace + + +\`\`\`Context Menu Options\`\`\` +\`Summarize thread\` - Post a summary of a thread with one simple click + + +*:question: What does that reaction mean?* + +:shushing_face: - To indicate Command should stop responding in the current thread. +:warning: - An error occurred while processing the specific message that has this reaction. The message sender will be provided with more information regarding the error in an ephemeral message. + + +For further support, feel free to reach out to . +`; + +export const ACCEPTABLE_SUMMARIZE_FILE_TYPES = new Set(['pdf', 'doc', 'docx', 'text']); +export const ACCEPTABLE_RAG_CHAT_FILE_TYPES = new Set(['pdf']); + +export const DEPLOYMENT_COHERE_PLATFORM = 'Cohere Platform'; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleError.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleError.ts new file mode 100644 index 0000000000000000000000000000000000000000..05e851ff7c3e748dbcce7341e3332d758edd98e4 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleError.ts @@ -0,0 +1,71 @@ +import { AllMiddlewareArgs } from '@slack/bolt'; + +import { ERRORS, SLACK_API_ERRORS } from '../constants'; +import { getEphemeralBlocks } from '../utils/getMessageBlocks'; + +type HandleError = Pick & { + error?: any; + userId?: string; + includeUserIdInMsg?: boolean; + replyChannelId?: string; + replyThreadTs?: string; + customErrorMsg?: string; + messageTs?: string; +}; + +/** + * This function does basic error handling in the form of posting an ephemeral + * message to the user to notify them that something's not right. + * This includes; handling slack api errors, cohere API error and other general errors. + */ +export const handleError = async ({ + error, + userId, + includeUserIdInMsg = true, + replyChannelId, + replyThreadTs, + client, + customErrorMsg, + messageTs, +}: HandleError) => { + // Return early if user unknown - ephemeral message are only visible to the user, + if (!userId) return; + + const errorMsg = customErrorMsg || SLACK_API_ERRORS[error?.data?.error] || ERRORS.GENERAL; + const formattedUserId = includeUserIdInMsg ? `<@${userId}> ` : ''; + /** + * Try to post an error message in the channel the event occurred in, + * If that fails, try to send a DM to the user. + * Common Error response from slack: https://api.slack.com/methods/conversations.replies#examples + */ + + const slackResponse = + replyChannelId && + (await client.chat + .postEphemeral({ + text: `${formattedUserId}${errorMsg}`, + blocks: getEphemeralBlocks({ text: `${formattedUserId}${errorMsg}` }), + thread_ts: replyThreadTs, + channel: replyChannelId, + user: userId, + }) + .catch((errorRes) => console.error(errorRes))); + + if (!slackResponse) { + await client.chat + .postEphemeral({ + text: errorMsg, + channel: userId, + user: userId, + }) + .catch((errorRes) => console.error(errorRes)); + } + if (messageTs) + await client.reactions + .add({ + channel: replyChannelId, + name: 'warning', + timestamp: messageTs, + }) + .catch((errorRes) => console.error(errorRes)); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleFirstReply.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleFirstReply.ts new file mode 100644 index 0000000000000000000000000000000000000000..3552f42d491e21b8d4b1af820f60fe15ca139e7a --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleFirstReply.ts @@ -0,0 +1,203 @@ +import { Context, SayFn } from '@slack/bolt'; +import { WebClient } from '@slack/web-api'; + +import { ALERTS, ERRORS, MAX_PROMPT_LENGTH, PENDING_MESSAGES } from '../constants'; +import { ValidAction } from '../utils/actions'; +import { getChannelSettings } from '../utils/getChannelSettings'; +import { getConversationId } from '../utils/getConversationId'; +import { getContentBlocks, getEphemeralBlocks, getFeedbackBlocks } from '../utils/getMessageBlocks'; +import { getReply } from '../utils/getReply'; +import { handleError, handleRagChatWithFile, handleSummarizeFile } from './'; + +type HandleFirstReplyArgs = { + client: WebClient; + action: ValidAction; + context: Context; + say: SayFn; +}; + +/** + * This function deals with the first response which can be in a thread or in a DM + */ +export const handleFirstReply = async ({ context, action, client, say }: HandleFirstReplyArgs) => { + const event = action.event; + // If the message is not sent by a user, return + if (!event.user) return; + + const userId = event.user; + const channelId = event.channel; + const eventTs = event.ts; + const teamId = context.teamId; + const enterpriseId = context.enterpriseId; + const messageTs = event.ts; + const basicErrorHandlerArgs = { + client, + userId, + replyChannelId: channelId, + replyThreadTs: eventTs, + messageTs, + }; + + const { conversationId } = getConversationId({ threadTs: eventTs, channelId }); + + const { deployment, model, temperature, preambleOverride } = await getChannelSettings({ + teamId, + enterpriseId, + channelId, + }); + + const msg = await say({ + text: PENDING_MESSAGES[action.type], + thread_ts: eventTs, + }); + + if (!msg.ok || !msg.ts) { + await handleError({ + customErrorMsg: ERRORS.GENERAL, + ...basicErrorHandlerArgs, + }); + return; + } + + if (event.text && event.text.length > MAX_PROMPT_LENGTH) { + await client.chat.postEphemeral({ + text: ALERTS.PROMPT_TOO_LONG, + channel: channelId, + user: userId, + thread_ts: eventTs, + blocks: getEphemeralBlocks({ text: ALERTS.PROMPT_TOO_LONG }), + }); + } + + let responseID, currentBotReply, errorMessage; + + switch (action.type) { + case 'file-summarize': + ({ responseID, currentBotReply, errorMessage } = await handleSummarizeFile({ + file: action.file, + teamId, + enterpriseId, + deployment, + model, + })); + break; + case 'file-rag': + ({ responseID, currentBotReply, errorMessage } = await handleRagChatWithFile({ + client, + text: event.text || '', + file: action.file, + deployment, + model, + teamId, + botUserId: context.botUserId, + enterpriseId, + conversationId, + isFirstMessage: true, + })); + break; + case 'chat-rag': + ({ responseID, currentBotReply, errorMessage } = await getReply({ + event: action.event, + tools: action.tools, + client, + deployment, + model, + conversationId, + temperature, + preambleOverride, + botUserId: context.botUserId, + isFirstMessage: true, + })); + break; + case 'file-invalid': + await handleError({ + customErrorMsg: + action.originalAction === 'file-rag' + ? ERRORS.INVALID_RAG_CHAT_FILE_TYPE + : ERRORS.INVALID_SUMMARIZE_FILE_TYPE, + ...basicErrorHandlerArgs, + }); + // We intentionally do not break here so we can fall through to normal chat + case 'chat': + ({ responseID, currentBotReply, errorMessage } = await getReply({ + event: action.event, + client, + deployment, + model, + conversationId, + temperature, + preambleOverride, + botUserId: context.botUserId, + isFirstMessage: true, + })); + break; + default: + return; + } + + if (errorMessage || !currentBotReply || !responseID) { + await handleError({ + customErrorMsg: errorMessage ? `${ERRORS.PREFIX} ${errorMessage}` : ERRORS.GENERAL, + ...basicErrorHandlerArgs, + }); + await client.chat.delete({ + channel: channelId, + ts: msg.ts, + }); + return; + } + + // Allows for easy backtracking from response to backend call to address potential issues + const { permalink } = await client.chat.getPermalink({ + channel: channelId, + message_ts: msg.ts, + }); + console.log(`New Generation: ${permalink} - ${responseID}`); + + // We chunk by 2990 to allow space for the message number and total message count + // The extra 10 characters allows for up to 999 messages: "[999/999] " + // The last character is the word boundary if it is included in the chunk + let rawMsgChunks = currentBotReply.match( + /[\w\W]{1,2989}(?:[\p{Punctuation}|\p{White_Space}]|$)+?/gmu, + ); + + // If the message can't be chunked properly, we have to chunk without respecting word boundaries + if (!rawMsgChunks || rawMsgChunks.join('').length !== currentBotReply.length) { + rawMsgChunks = currentBotReply.match(/[\w\W]{1,2989}/gm); + } + + const msgChunks = rawMsgChunks?.map((s) => s.trim()) || []; + const totalChunkCount = msgChunks.length; + const lastChunk = msgChunks.pop() || ''; + + for (const [idx, chunk] of msgChunks.entries()) { + const chunkWithNumber = `[${idx + 1}/${totalChunkCount}] ${chunk}`; + const contentBlocks = getContentBlocks(chunkWithNumber); + + await say({ + text: chunk, + thread_ts: eventTs, + blocks: [...contentBlocks], + }); + } + + const lastChunkWithNumber = `[${totalChunkCount}/${totalChunkCount}] ${lastChunk}`; + const lastChunkContentBlock = getContentBlocks( + totalChunkCount > 1 ? lastChunkWithNumber : lastChunk, + ); + const feedbackBlocks = getFeedbackBlocks({ + responseID, + threadTs: eventTs, + }); + + await client.chat.delete({ + channel: channelId, + ts: msg.ts, + }); + + await say({ + text: lastChunk, + thread_ts: eventTs, + blocks: [...lastChunkContentBlock, ...feedbackBlocks], + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleRagChatWithFile.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleRagChatWithFile.ts new file mode 100644 index 0000000000000000000000000000000000000000..85be6ede56a3f41fbb05b90615202562f91f3369 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleRagChatWithFile.ts @@ -0,0 +1,122 @@ +import { WebClient } from '@slack/web-api'; +import { formatRagCitations } from 'src/utils/formatRagCitations'; + +import { ApiError, OpenAPI, ToolkitClient } from '../cohere-client'; +import { DEPLOYMENT_COHERE_PLATFORM, ERRORS } from '../constants'; +import { PageText, SlackFile, getFileChunks } from '../utils/files'; +import { getSanitizedMessage } from '../utils/getSanitizedMessage'; +import { GetUsersRealNameArgs, getUsersRealName } from '../utils/getUsersRealName'; +import { getSlackFile } from '../utils/slackAuth'; + +type HandleRagChatWithFile = { + client: WebClient; + file: SlackFile | undefined; + text: string; + deployment: string | null; + model: string | null; + teamId?: string; + botUserId?: string; + enterpriseId?: string; + conversationId: string | undefined; + isFirstMessage?: boolean; +}; + +type Reply = { + currentBotReply?: string; + responseID?: string; + errorMessage?: string; +}; + +export const handleRagChatWithFile = async ({ + client, + file, + text, + deployment, + model, + teamId, + botUserId, + enterpriseId, + conversationId, + isFirstMessage = false, +}: HandleRagChatWithFile): Promise => { + // This should never be triggered, but just in case + if (!file || !file.url_private) { + return { + errorMessage: ERRORS.CHAT, + }; + } + + const message = await getSanitizedMessage({ + message: text, + getUsersRealName: async ({ userId }: GetUsersRealNameArgs) => + getUsersRealName({ userId, client }), + botUserId, + isFirstMessage, + }); + + const fileData = await getSlackFile(file.url_private, enterpriseId, teamId); + + let fileChunks: PageText[] = []; + try { + fileChunks = await getFileChunks(file, fileData); + } catch (error) { + return { + errorMessage: `handleRagChatWithFile - unexpected error ${error}`, + }; + } + + try { + const documents = fileChunks.map((chunk, index) => { + return { + id: `${index}`, + title: `page: ${chunk.pageNumber}`, + text: chunk.text, + url: `page: ${chunk.pageNumber}`, + }; + }); + const toolkitClient = new ToolkitClient(OpenAPI); + const chatResponse = await toolkitClient.default.chatV1ChatPost({ + requestBody: { + message, + model, + documents, + conversation_id: conversationId, + temperature: 0.1, + prompt_truncation: 'AUTO_PRESERVE_ORDER', + }, + deploymentName: deployment ? deployment : DEPLOYMENT_COHERE_PLATFORM, + }); + + const sanitizedBotReply = await getSanitizedMessage({ + message: chatResponse.text, + getUsersRealName: async ({ userId }: GetUsersRealNameArgs) => + getUsersRealName({ userId, client }), + }); + + const botReply = sanitizedBotReply + formatRagCitations(chatResponse); + + if (!chatResponse.generation_id) { + return { + currentBotReply: '', + responseID: '', + errorMessage: ERRORS.GENERAL, + }; + } + + return { currentBotReply: botReply, responseID: chatResponse.generation_id }; + } catch (error: any) { + console.error(error); + if (error instanceof ApiError) { + return { + currentBotReply: '', + responseID: '', + errorMessage: error.message, + }; + } + return { + currentBotReply: '', + responseID: '', + errorMessage: ERRORS.GENERAL, + }; + } +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleSummarizeFile.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleSummarizeFile.ts new file mode 100644 index 0000000000000000000000000000000000000000..2a60616dfd2ddc86f6abadc8cef43db689d61f4a --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleSummarizeFile.ts @@ -0,0 +1,75 @@ +import { ApiError, OpenAPI, ToolkitClient } from '../cohere-client'; +import { ALERTS, DEPLOYMENT_COHERE_PLATFORM, ERRORS, PROMPTS } from '../constants'; +import { SlackFile, getFileRawText } from '../utils/files'; +import { getSlackFile } from '../utils/slackAuth'; + +type HandleSummarizeFileArgs = { + file?: SlackFile; + teamId?: string; + enterpriseId?: string; + deployment?: string | null; + model?: string | null; +}; + +type Reply = { + currentBotReply?: string; + responseID?: string; + errorMessage?: string; +}; + +export const handleSummarizeFile = async ({ + file, + teamId, + enterpriseId, + deployment, + model, +}: HandleSummarizeFileArgs): Promise => { + // This should never be triggered, but just in case + if (!file || !file.url_private) { + return { + errorMessage: ERRORS.SUMMARIZE, + }; + } + + const fileData = await getSlackFile(file.url_private, enterpriseId, teamId); + + let fileText = ''; + try { + fileText = await getFileRawText(file, fileData); + } catch (error) { + console.error('handleSummarizeFile - unexpected error', error); + return { + errorMessage: ERRORS.INVALID_SUMMARIZE_FILE_TYPE, + }; + } + + if (fileText.length < 500) { + return { + errorMessage: ERRORS.SUMMARIZE_CHAR_LIMIT, + }; + } + try { + const toolkitClient = new ToolkitClient(OpenAPI); + const summaryResponse = await toolkitClient.default.chatV1ChatPost({ + requestBody: { + message: PROMPTS.summarizeFile(fileText), + model: model, + }, + deploymentName: deployment ? deployment : DEPLOYMENT_COHERE_PLATFORM, + }); + const currentBotReply = `${ALERTS.FILE_SUMMARY_PREFIX}${ + file.name ? `\n\n*Original File Name:* \`${file.name}\`` : '' + }\n\n${summaryResponse.text}`; + + return { + currentBotReply, + responseID: summaryResponse.response_id || undefined, + }; + } catch (error) { + console.error(error); + if (error instanceof ApiError) { + return { currentBotReply: '', responseID: '', errorMessage: error.message }; + } + return { currentBotReply: '', responseID: '', errorMessage: ERRORS.SUMMARIZE }; + } +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleSummarizeThread.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleSummarizeThread.ts new file mode 100644 index 0000000000000000000000000000000000000000..274bcdf6870efca8b714a47071dbfdf7ce4d1eb1 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleSummarizeThread.ts @@ -0,0 +1,152 @@ +import { AllMiddlewareArgs, Context, MessageEvent, RespondFn, SayFn } from '@slack/bolt'; + +import { ApiError, OpenAPI, ToolkitClient } from '../cohere-client'; +import { ALERTS, DEPLOYMENT_COHERE_PLATFORM, ERRORS, PROMPTS } from '../constants'; +import { getEphemeralBlocks } from '../utils/getMessageBlocks'; +import { getSanitizedConversationHistory } from '../utils/getSanitizedConversationHistory'; +import { handleError } from './'; + +type HandleSummarizeThreadArgs = Pick & { + context: Context; + userId: string; + threadChannelId: string; + threadTs: string; + say: SayFn | RespondFn; + currentChannelId?: string; + deployment?: string | null; + model?: string | null; +}; + +/** + * This function deals with providing a summary of a thread passed down to it. + * It also handles the edge cases of the thread not having enough characters to summarize, + * and posts helper ephemeral message(s) + * + */ +export const handleSummarizeThread = async ({ + context, + userId, + client, + threadChannelId, + threadTs, + say, + currentChannelId, + deployment, + model, +}: HandleSummarizeThreadArgs) => { + /** + * If a currentChannelId is provided, the reply can be posted in that channel, + * otherwise post in the thread. + */ + const replyChannelId = currentChannelId || threadChannelId; + const replyThreadTs = currentChannelId ? undefined : threadTs; + + /** + * Conversation Replies Method - https://api.slack.com/methods/conversations.replies + * Retrieve all thread replies using slack api + */ + const basicErrorHandlerArgs = { client, userId, replyChannelId, replyThreadTs }; + const slackMessageHistoryResponse = await client.conversations + .replies({ + channel: threadChannelId, + ts: threadTs, + }) + .catch(async (error) => await handleError({ error, ...basicErrorHandlerArgs })); + + if (!slackMessageHistoryResponse) return; + + /** + * We want to avoid summarizing private conversation + * threads that the user is not a part of + */ + const channelHasCurrentUser = await client.conversations + .members({ + channel: threadChannelId, + }) + .then((data) => data.members?.includes(userId)) + .catch(async (error) => await handleError({ error, ...basicErrorHandlerArgs })); + + const isConvoPrivate = await client.conversations + .info({ channel: threadChannelId }) + .then((data) => data.channel && data.channel.is_private) + .catch(async (error) => await handleError({ error, ...basicErrorHandlerArgs })); + + if (!channelHasCurrentUser && isConvoPrivate) { + await handleError({ + customErrorMsg: ERRORS.USER_NOT_IN_CHANNEL, + ...basicErrorHandlerArgs, + includeUserIdInMsg: false, + }); + return; + } + + const messageHistory = slackMessageHistoryResponse.messages; + const { sanitizedConversationHistoryString } = await getSanitizedConversationHistory({ + context, + client, + // the "as" is needed to convert back to Bolt types + messageHistory: messageHistory as Array, + format: 'string', + }); + + //Summarize endpoint requires at least 500 characters + if (sanitizedConversationHistoryString && sanitizedConversationHistoryString.length < 500) { + await handleError({ + customErrorMsg: ERRORS.SUMMARIZE_CHAR_LIMIT, + ...basicErrorHandlerArgs, + }); + return; + } + + // Post an ephemeral message to the user notifying them that the command is registered + try { + await client.chat.postEphemeral({ + text: `<@${userId}> ${ALERTS.SUMMARIZE_COMMAND_REGISTERED}`, + blocks: getEphemeralBlocks({ + text: `<@${userId}> ${ALERTS.SUMMARIZE_COMMAND_REGISTERED}`, + isDismissible: false, + }), + thread_ts: replyThreadTs, + channel: replyChannelId, + user: userId, + }); + } catch (error) { + console.error(error); + } + try { + const toolkitClient = new ToolkitClient(OpenAPI); + const summaryResponse = await toolkitClient.default.chatV1ChatPost({ + requestBody: { + message: PROMPTS.summarizeThread(sanitizedConversationHistoryString as string), + model, + }, + deploymentName: deployment ? deployment : DEPLOYMENT_COHERE_PLATFORM, + }); + /** + * If we're not posting in the original thread,(currentChannelId is provided) + * we want to provide a link to the original thread for reference + */ + const originalThreadLink = currentChannelId + ? `\n:link: ` + : ''; + + await say({ + response_type: 'in_channel', + text: `${ALERTS.THREAD_SUMMARY_PREFIX}${originalThreadLink}\n\n${summaryResponse.text}\n\ncc: <@${userId}>`, + thread_ts: replyThreadTs, + }); + } catch (error) { + console.error(error); + let customErrorMsg = ERRORS.SUMMARIZE; + if (error instanceof ApiError) { + customErrorMsg = error.message; + } + await handleError({ + customErrorMsg, + ...basicErrorHandlerArgs, + }); + return; + } +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleThreadReply.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleThreadReply.ts new file mode 100644 index 0000000000000000000000000000000000000000..8f0a0dda9d698951bcb2a9a30f7d2fb4bd4a1088 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleThreadReply.ts @@ -0,0 +1,264 @@ +import { + AllMiddlewareArgs, + AppMentionEvent, + Context, + MessageEvent, + RespondFn, + SayFn, +} from '@slack/bolt'; + +import { + ALERTS, + ERRORS, + MAX_PROMPT_LENGTH, + PENDING_MESSAGES, + STOP_REPLYING_MESSAGE, +} from '../constants'; +import { SlackMessages, ValidAction } from '../utils/actions'; +import { getChannelSettings } from '../utils/getChannelSettings'; +import { getConversationId } from '../utils/getConversationId'; +import { getContentBlocks, getEphemeralBlocks, getFeedbackBlocks } from '../utils/getMessageBlocks'; +import { getReply } from '../utils/getReply'; +import { getSanitizedConversationHistory } from '../utils/getSanitizedConversationHistory'; +import { + handleError, + handleRagChatWithFile, + handleSummarizeFile, + removePrevBotMsgFeedbackButtons, +} from './'; + +type HandleThreadReplyArgs = Pick & { + context: Context; + action: ValidAction; + messages: SlackMessages; + say: SayFn | RespondFn; +}; + +/** + * This function deals with all thread replies within channels and group messages + * excluding the first reply (app mention) + */ +export const handleThreadReply = async ({ + context, + action, + client, + messages, + say, +}: HandleThreadReplyArgs) => { + const event = action.event; + // If the message is not sent by a user, return + if (!event.user) return; + // If the message is not in a thread, return + if (!event.thread_ts) return; + + const threadTs = event.thread_ts; + const threadChannelId = event.channel; + const userId = event.user; + const messageTs = event.ts; + const basicErrorHandlerArgs = { + client, + userId, + replyChannelId: threadChannelId, + replyThreadTs: threadTs, + messageTs, + }; + const teamId = context.teamId; + const enterpriseId = context.enterpriseId; + + const { deployment, model, temperature, preambleOverride } = await getChannelSettings({ + teamId, + enterpriseId, + channelId: threadChannelId, + }); + + const { conversationId } = getConversationId({ + threadTs, + channelId: threadChannelId, + }); + + // If there's no message history, this event shouldn't have been triggered + if (!messages) return; + + const { hasStopReplyingCommand, hasBotAckStopReplyingCommand } = + await getSanitizedConversationHistory({ + context, + client, + // the "as" is needed to convert back to Bolt types + messageHistory: messages as Array, + }); + if (hasBotAckStopReplyingCommand) return; + if (hasStopReplyingCommand) { + await say({ + text: STOP_REPLYING_MESSAGE, + thread_ts: threadTs, + }); + + await removePrevBotMsgFeedbackButtons({ + client, + context, + channel: threadChannelId, + messageHistory: messages as Array, + }); + return; + } + + const msg = await say({ + text: PENDING_MESSAGES[action.type], + thread_ts: threadTs, + }); + + if (!msg.ok || !msg.ts) { + await handleError({ + customErrorMsg: ERRORS.GENERAL, + ...basicErrorHandlerArgs, + }); + return; + } + + if (event.text && event.text.length > MAX_PROMPT_LENGTH) { + await client.chat.postEphemeral({ + text: ALERTS.PROMPT_TOO_LONG, + channel: threadChannelId, + user: userId, + thread_ts: threadTs, + blocks: getEphemeralBlocks({ text: ALERTS.PROMPT_TOO_LONG }), + }); + } + + let responseID, currentBotReply, errorMessage; + switch (action.type) { + case 'file-summarize': + ({ responseID, currentBotReply, errorMessage } = await handleSummarizeFile({ + file: action.file, + teamId, + enterpriseId, + })); + break; + case 'file-rag': + ({ responseID, currentBotReply, errorMessage } = await handleRagChatWithFile({ + client, + text: event.text || '', + file: action.file, + deployment, + model, + teamId, + botUserId: context.botUserId, + enterpriseId, + conversationId, + isFirstMessage: true, + })); + break; + case 'chat-rag': + ({ responseID, currentBotReply, errorMessage } = await getReply({ + event: action.event, + tools: action.tools, + client, + deployment, + model, + conversationId, + temperature, + preambleOverride, + botUserId: context.botUserId, + isFirstMessage: true, + })); + break; + case 'file-invalid': + await handleError({ + customErrorMsg: + action.originalAction === 'file-rag' + ? ERRORS.INVALID_RAG_CHAT_FILE_TYPE + : ERRORS.INVALID_SUMMARIZE_FILE_TYPE, + ...basicErrorHandlerArgs, + }); + // Intentionally fall through to normal chat + case 'chat': + ({ responseID, currentBotReply, errorMessage } = await getReply({ + event: action.event, + client, + deployment, + model, + conversationId, + temperature, + preambleOverride, + botUserId: context.botUserId, + isFirstMessage: true, + })); + break; + default: + return; + } + + if (!currentBotReply || !responseID || errorMessage) { + await client.chat.delete({ + channel: threadChannelId, + ts: msg.ts, + }); + await handleError({ + customErrorMsg: errorMessage ? `${ERRORS.PREFIX} ${errorMessage}` : ERRORS.CHAT, + ...basicErrorHandlerArgs, + }); + + return; + } + + // Allows for easy backtracking from response to backend call to address potential issues + const { permalink } = await client.chat.getPermalink({ + channel: msg.channel, + message_ts: msg.ts, + }); + console.log(`New Generation: ${permalink} - ${responseID}`); + + await removePrevBotMsgFeedbackButtons({ + client, + context, + channel: threadChannelId, + messageHistory: messages as Array, + }); + + // We chunk by 2990 to allow space for the message number and total message count + // The extra 10 characters allows for up to 999 messages: "[999/999] " + // The extra character is the word boundary if it is included in the chunk + let rawMsgChunks = currentBotReply.match( + /[\w\W]{1,2989}(?:[\p{Punctuation}|\p{White_Space}]|$)+?/gmu, + ); + + // If the message can't be chunked properly, we have to chunk without respecting word boundaries + if (!rawMsgChunks || rawMsgChunks.join('').length !== currentBotReply.length) { + rawMsgChunks = currentBotReply.match(/[\w\W]{1,2989}/gm); + } + + const msgChunks = rawMsgChunks?.map((s) => s.trim()) || []; + const totalChunkCount = msgChunks.length; + const lastChunk = msgChunks.pop() || ''; + + for (const [idx, chunk] of msgChunks.entries()) { + const chunkWithNumber = `[${idx + 1}/${totalChunkCount}] ${chunk}`; + const contentBlocks = getContentBlocks(chunkWithNumber); + + await say({ + text: chunk, + thread_ts: threadTs, + blocks: [...contentBlocks], + }); + } + + const lastChunkWithNumber = `[${totalChunkCount}/${totalChunkCount}] ${lastChunk}`; + const lastChunkContentBlock = getContentBlocks( + totalChunkCount > 1 ? lastChunkWithNumber : lastChunk, + ); + const feedbackBlocks = getFeedbackBlocks({ + responseID, + threadTs: threadTs, + }); + + await client.chat.delete({ + channel: threadChannelId, + ts: msg.ts, + }); + + await say({ + text: lastChunk, + thread_ts: threadTs, + blocks: [...lastChunkContentBlock, ...feedbackBlocks], + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleUserActions.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleUserActions.ts new file mode 100644 index 0000000000000000000000000000000000000000..9acdbc6f1d820205464712e59c05296139185cf8 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/handleUserActions.ts @@ -0,0 +1,162 @@ +import { + AckFn, + AllMiddlewareArgs, + AppMentionEvent, + Context, + DialogValidation, + MessageEvent, + RespondFn, + SayArguments, + SectionBlock, + SlackAction, +} from '@slack/bolt'; + +import { ERRORS, STOP_REPLYING_MESSAGE } from '../constants'; + +type Message = MessageEvent | AppMentionEvent; + +type HandleStopConversationArgs = Pick & { + ack: AckFn | AckFn | AckFn; + body: SlackAction; + respond: RespondFn; +}; + +type RemoveFeedbackButtonArgs = Pick & { + channel: string; + text: string; + ts: string; +}; + +type RemovePrevBotMsgFeedbackButtonsArgs = Pick & { + channel: string; + context: Context; + messageHistory: Array; +}; + +/** + * Replaces message content with just the text, thereby removing any buttons or other interactive additions + * This is used to remove the feedback buttons after the user has clicked one + * Can also be used to update text after a user has submitted a rewritten response + */ +const removeFeedbackButtons = async ({ client, channel, text, ts }: RemoveFeedbackButtonArgs) => { + await client.chat.update({ + channel, + ts, + text, + blocks: [ + { + type: 'section', + text: { + type: 'mrkdwn', + text: text, + }, + }, + ], + }); +}; + +/** + * Removes the feedback buttons from prior bot responses + * This is to ensure that the conversation history won't be significantly altered + * in the middle of a conversation + */ +export const removePrevBotMsgFeedbackButtons = async ({ + client, + context, + channel, + messageHistory, +}: RemovePrevBotMsgFeedbackButtonsArgs) => { + const filteredMessageHistory = messageHistory.filter( + /** + * Check 1: We only care about messages, not events; Gets rid of TS weirdness + * Check 3: Feedback buttons are only generated from block actions + * If we remove all of the block actions, it shows as edited + */ + (msg) => + msg.subtype === undefined && + msg.user === context.botUserId && + msg.blocks?.some((block) => block.type === 'actions'), + ); + + for (let message of filteredMessageHistory) { + // We only care about messages, not events; Gets rid of TS weirdness + if (message.subtype !== undefined) continue; + + let text = message.text ?? ''; + let sectionBlocks = message.blocks?.filter((block) => block.type === 'section'); + if (sectionBlocks) { + // TS doesn't understand that we've already checked for this in the filter + let typedSectionBlock = sectionBlocks[0] as SectionBlock; + text = typedSectionBlock.text?.text ?? text; + } + + await removeFeedbackButtons({ + client, + channel, + text, + ts: message.ts, + }); + } +}; + +export const handleStopConversation = async ({ + client, + ack, + body, + respond, +}: HandleStopConversationArgs) => { + await ack(); + + // Stop buttons are only generated from block actions + if (body.type !== 'block_actions') { + await respond({ + response_type: 'ephemeral', + text: ERRORS.GENERAL, + }); + console.error("handleStopConversation: body.type !== 'block_actions'"); + return; + } + + // Stop button should be a... button + if (body.actions[0].type !== 'button') { + await respond({ + response_type: 'ephemeral', + text: ERRORS.GENERAL, + }); + console.error("handleStopConversation: body.actions[0].type !== 'button'"); + return; + } + + // Feedback buttons should only exist on messages + if (!body.message) { + await respond({ + response_type: 'ephemeral', + text: ERRORS.GENERAL, + }); + console.error('handleUserFeedback: !body.message'); + return; + } + + // Messages have to exist in channels + if (!body.channel) { + await respond({ + response_type: 'ephemeral', + text: ERRORS.GENERAL, + }); + console.error('handleUserFeedback: !body.channel'); + return; + } + + await client.chat.postMessage({ + channel: body.channel.id, + thread_ts: body.message.ts, + text: STOP_REPLYING_MESSAGE, + }); + + await removeFeedbackButtons({ + client, + channel: body.channel.id, + text: body.message.text || '', + ts: body.message.ts, + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/index.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..9a26401f1ff2f2ee44df5337f6872412ee55ab0e --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/handlers/index.ts @@ -0,0 +1,7 @@ +export * from './handleError'; +export * from './handleSummarizeThread'; +export * from './handleFirstReply'; +export * from './handleSummarizeFile'; +export * from './handleRagChatWithFile'; +export * from './handleThreadReply'; +export * from './handleUserActions'; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/index.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..97ddc055fc7490f74b48fd87c5f6111209e40a08 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/index.ts @@ -0,0 +1,391 @@ +import { Prisma, PrismaClient } from '@prisma/client'; +import * as Sentry from '@sentry/node'; +import { App, AppOptions, Installation } from '@slack/bolt'; +import { ExtendedErrorHandler } from '@slack/bolt/dist/App'; +import * as dotenv from 'dotenv'; + +import { OpenAPI } from './cohere-client/'; +import { + commandHelp, + setDeployment, + setModel, + setPreamble, + setTemperature, + setTools, + setupCommand, + summarize, + viewDeployment, + viewModel, + viewPreamble, + viewTemperature, + viewTools, +} from './commands'; +import { ALERTS, COMMAND_SUFFIX } from './constants'; +import { handleFirstReply, handleThreadReply } from './handlers'; +import { dismissEphemeral, stopConversation } from './reactions'; +import { summarizeThread } from './shortcuts'; +import { determineAction, isAppMentionEvent } from './utils/actions'; +import { extractMessageHistory } from './utils/messageHistory'; +import { apiView, toolsView } from './views'; + +export let prisma: PrismaClient; + +/** + * Due to some issues with Bolt and TS, there will be some need of 'any' typecasting. + * Still using typescript as Bolt might improve TS support down the line. + * ref for errs: https://github.com/slackapi/bolt-js/issues/904 + */ + +if (process.env.NODE_ENV === 'development') { + console.log(`Loading environment variables from .env`); + dotenv.config({ path: '.env' }); +} + +if (!process.env.SLACK_CONNECTION_MODE) { + throw new Error( + 'Error: SLACK_CONNECTION_MODE is not set. It must be set to either "socket" or "http".', + ); +} + +if (!process.env.SLACK_SIGNING_SECRET) { + throw new Error('Error: SLACK_SIGNING_SECRET is not set'); +} + +if (!process.env.DATABASE_URL) { + throw new Error('Error: DATABASE_URL is not set.'); +} + +if (process.env.SLACK_CONNECTION_MODE === 'socket') { + if (!process.env.SLACK_BOT_TOKEN) { + throw new Error('Error: SLACK_BOT_TOKEN is not set. It is required in socket mode.'); + } + if (!process.env.SLACK_APP_TOKEN) { + throw new Error('Error: SLACK_APP_TOKEN is not set. It is required in socket mode.'); + } +} else { + if (!process.env.SLACK_CLIENT_ID) { + throw new Error('Error: SLACK_CLIENT_ID is not set. It is required in http mode.'); + } + if (!process.env.SLACK_CLIENT_SECRET) { + throw new Error('Error: SLACK_CLIENT_SECRET is not set. It is required in http mode.'); + } + if (!process.env.SLACK_STATE_SECRET) { + throw new Error('Error: SLACK_STATE_SECRET is not set. It is required in http mode.'); + } + if (!process.env.SLACK_INSTALL_PASSWORD) { + console.warn(`SLACK_INSTALL_PASSWORD is not set. Slack app is open for public installations.`); + } +} + +/** + * Instantiate Prisma Client. + */ +prisma = new PrismaClient({ + datasources: { + db: { + url: process.env.DATABASE_URL, + }, + }, +}); + +/** + * Enable Sentry error monitoring when DSN key is in env. This is not required for development. + */ +if (process.env.SENTRY_DSN) { + Sentry.init({ + dsn: process.env.SENTRY_DSN, + tracesSampleRate: 1.0, + }); +} + +/** + * Error handling + * See https://github.com/slackapi/bolt-js/blob/9e0b8ac8507000118ddc11d29cbce0b4d5dc9bfb/docs/_advanced/error_handling.md + */ +const errorHandler: ExtendedErrorHandler = async ({ error }) => { + // todo: handle errors properly + console.error(error); + Sentry.captureException(error); +}; + +const appOptions: AppOptions = + process.env.SLACK_CONNECTION_MODE === 'socket' + ? { + signingSecret: process.env.SLACK_SIGNING_SECRET, + extendedErrorHandler: true, + socketMode: true, + token: process.env.SLACK_BOT_TOKEN, + appToken: process.env.SLACK_APP_TOKEN, + } + : { + installerOptions: { + ...(process.env.SLACK_INSTALL_PASSWORD && { + installPath: `/slack/install/${process.env.SLACK_INSTALL_PASSWORD}`, + }), + directInstall: true, + }, + signingSecret: process.env.SLACK_SIGNING_SECRET, + extendedErrorHandler: true, + clientId: process.env.SLACK_CLIENT_ID, + clientSecret: process.env.SLACK_CLIENT_SECRET, + stateSecret: process.env.SLACK_STATE_SECRET, + + scopes: [ + 'app_mentions:read', + 'channels:history', + 'channels:read', + 'chat:write', + 'commands', + 'groups:history', + 'im:history', + 'im:read', + 'im:write', + 'mpim:history', + 'mpim:read', + 'mpim:write', + 'reactions:read', + 'users:read', + 'groups:read', + 'reactions:write', + 'files:read', + ], + + installationStore: { + storeInstallation: async (installation) => { + const welcomeMessage = async (type: 'create' | 'update') => { + if (installation.bot === undefined) return; + const welcomeMsg = ALERTS.installMessage(type); + return await app.client.chat.postMessage({ + token: installation.bot.token, + channel: installation.user.id, + text: welcomeMsg, + }); + }; + + if (installation.isEnterpriseInstall && installation.enterprise !== undefined) { + // handle storing org-wide app installation + const oAuthInstallation = await prisma.oAuthInstallation.findFirst({ + where: { enterpriseId: installation.enterprise.id }, + }); + + if (oAuthInstallation !== null) { + await prisma.oAuthInstallation.update({ + where: { enterpriseId: installation.enterprise.id }, + data: { installation: installation as unknown as Prisma.JsonObject }, + }); + await welcomeMessage('update'); + return; + } else { + await prisma.oAuthInstallation.create({ + data: { + enterpriseId: installation.enterprise.id, + installation: installation as unknown as Prisma.JsonObject, + }, + }); + await welcomeMessage('create'); + return; + } + } + if (installation.team !== undefined) { + // single team app installation + const oAuthInstallation = await prisma.oAuthInstallation.findFirst({ + where: { teamId: installation.team.id }, + }); + + if (oAuthInstallation !== null) { + await prisma.oAuthInstallation.update({ + where: { teamId: installation.team.id }, + data: { installation: installation as unknown as Prisma.JsonObject }, + }); + await welcomeMessage('update'); + return; + } else { + await prisma.oAuthInstallation.create({ + data: { + teamId: installation.team.id, + installation: installation as unknown as Prisma.JsonObject, + }, + }); + await welcomeMessage('create'); + return; + } + } + throw new Error('Failed saving installation data to installationStore'); + }, + fetchInstallation: async (installQuery) => { + if (installQuery.isEnterpriseInstall && installQuery.enterpriseId !== undefined) { + // handle org wide app installation lookup + const oAuthInstallation = await prisma.oAuthInstallation.findUniqueOrThrow({ + where: { enterpriseId: installQuery.enterpriseId }, + }); + return oAuthInstallation.installation as unknown as Installation<'v2', true>; + } + if (installQuery.teamId !== undefined) { + // single team app installation lookup + const oAuthInstallation = await prisma.oAuthInstallation.findUniqueOrThrow({ + where: { teamId: installQuery.teamId }, + }); + return oAuthInstallation.installation as unknown as Installation<'v2', false>; + } + throw new Error('Failed fetching installation'); + }, + deleteInstallation: async (installQuery) => { + if (installQuery.isEnterpriseInstall && installQuery.enterpriseId !== undefined) { + // org wide app installation deletion + await prisma.oAuthInstallation.delete({ + where: { enterpriseId: installQuery.enterpriseId }, + }); + return; + } + if (installQuery.teamId !== undefined) { + // single team app installation deletion + await prisma.oAuthInstallation.delete({ + where: { teamId: installQuery.teamId }, + }); + return; + } + throw new Error('Failed to delete installation'); + }, + }, + customRoutes: [ + { + path: '/health', + method: ['GET'], + handler: (req, res) => { + res.writeHead(200); + res.end(`Things are going just fine at ${req.headers.host}!`); + }, + }, + ], + }; + +/** + * Configure OpenAPI client settings. + */ +OpenAPI.HEADERS = { + 'User-Id': '1', +}; + +if (process.env.TOOLKIT_API_HOST) { + OpenAPI.BASE = process.env.TOOLKIT_API_HOST; +} + +/** + * Instantiate app. + */ +const app = new App(appOptions); +app.error(errorHandler); + +/** + * App Mentions - https://api.slack.com/events/app_mention + * This function deals with the first reply after the bot is mentioned + * in a channel or group message + */ +app.event('app_mention', async ({ context, event, say, client }) => { + /** + * The first message (until it's been replied to) does not have a thread_ts, + * therefore, 'return' if it exists. Threads are dealt with in a different function. + */ + if (event.thread_ts) return; + const action = await determineAction(context, event); + // Exit early if this is not a valid action + if (action.type === 'ignore') return; + + await handleFirstReply({ context, action, say, client }); +}); + +/** + * Message Event - https://api.slack.com/events/message + * This deals with threading messages in channels the bot is a part of, + * and all direct messages (DMs) to the bot. + */ +app.message(async ({ context, event, client, say }) => { + const messages = await extractMessageHistory(client, event); + const action = await determineAction(context, event, messages); + + // Exit early if this is not a valid action + if (action.type === 'ignore') return; + // Exit early if this is an app mention event since these are dealt with in a different function. + if (isAppMentionEvent(action.event)) return; + + const channelType = action.event.channel_type; + const threadTs = action.event.thread_ts; + const botUserId = context.botUserId; + + // For threaded replies + const firstMsgText = threadTs && messages[0].text; + const lastMsgText = threadTs && messages[messages.length - 1].text; + const firstMsgIncludesBot = firstMsgText && firstMsgText.includes(`<@${botUserId}>`); + const lastMsgIncludesBot = lastMsgText && lastMsgText.includes(`<@${botUserId}>`); + + // Handle First DM Message + + /** + * Handle Thread Response. Make sure the bot only replies to: + * 1. Threads within DMs + * 2. Threads who's first or latest message includes a bot mention + */ if ( + (channelType === 'im' && threadTs) || + ((firstMsgIncludesBot || lastMsgIncludesBot) && threadTs) + ) { + await handleThreadReply({ context, action, client, messages, say }); + } else if (channelType === 'im') await handleFirstReply({ context, action, client, say }); +}); + +/** + * Shortcuts - https://api.slack.com/interactivity/shortcuts/using#shortcut_types + */ + +//Sends a summary of the thread as a new message to the thread +app.shortcut('summarize_thread', summarizeThread); + +/** + * Slash Commands - https://api.slack.com/interactivity/slash-commands#getting_started + */ +app.command(`/command-help${COMMAND_SUFFIX}`, commandHelp); +app.command(`/set-tools${COMMAND_SUFFIX}`, setTools); +app.command(`/set-model${COMMAND_SUFFIX}`, setModel); +app.command(`/set-deployment${COMMAND_SUFFIX}`, setDeployment); +app.command(`/set-preamble${COMMAND_SUFFIX}`, setPreamble); +app.command(`/set-temperature${COMMAND_SUFFIX}`, setTemperature); +app.command(`/setup-command${COMMAND_SUFFIX}`, setupCommand); +app.command(`/summarize${COMMAND_SUFFIX}`, summarize); +app.command(`/view-tools${COMMAND_SUFFIX}`, viewTools); +app.command(`/view-deployment${COMMAND_SUFFIX}`, viewDeployment); +app.command(`/view-model${COMMAND_SUFFIX}`, viewModel); +app.command(`/view-preamble${COMMAND_SUFFIX}`, viewPreamble); +app.command(`/view-temperature${COMMAND_SUFFIX}`, viewTemperature); + +/** + * Views - Used to extract information from Modals after submission + */ + +app.view('api_view', apiView); +app.view('tools_view', toolsView); +app.view({ callback_id: 'api_view_success', type: 'view_closed' }, async ({ ack }) => { + await ack(); +}); +app.view({ callback_id: 'tools_view_success', type: 'view_closed' }, async ({ ack }) => { + await ack(); +}); + +/** + * Block Actions - https://api.slack.com/reference/block-kit/block-elements#button + */ + +// This action dismisses the ephemeral message sent by the bot when the button is clicked +app.action('dismiss_ephemeral', dismissEphemeral); + +// Feedback actions are tied to the feedback buttons put on every bot response +app.action('stop_conversation', stopConversation); + +// Input field acknowledgements - used to acknowledge the user's input within text fields and checkboxes +// Helps avoid errors on slack +app.action('checkbox-action', async ({ ack }) => await ack()); +app.action('api-key-lock-action', async ({ ack }) => await ack()); + +(async () => { + // Start your app + await app.start(process.env.PORT || 3000); + console.log('🪸 Slack bot is running!'); +})(); diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/reactions/dismissEphemeral.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/reactions/dismissEphemeral.ts new file mode 100644 index 0000000000000000000000000000000000000000..d05e6f9d69ae8be95bebaa23111e89af1feb4b80 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/reactions/dismissEphemeral.ts @@ -0,0 +1,9 @@ +import { Middleware, SlackActionMiddlewareArgs } from '@slack/bolt'; + +export const dismissEphemeral: Middleware = async ({ ack, respond }) => { + await ack(); + // Update the message to reflect the action + await respond({ + delete_original: true, + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/reactions/index.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/reactions/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..7c000475d3d65d6c2b1677f59782460373f0bf80 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/reactions/index.ts @@ -0,0 +1,2 @@ +export * from './dismissEphemeral'; +export * from './stopConversation'; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/reactions/stopConversation.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/reactions/stopConversation.ts new file mode 100644 index 0000000000000000000000000000000000000000..56b1ee6f2ac0929abf8c03c6c2d2416c9df635d7 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/reactions/stopConversation.ts @@ -0,0 +1,10 @@ +import { Middleware, SlackActionMiddlewareArgs } from '@slack/bolt'; + +import { handleStopConversation } from '../handlers'; + +export const stopConversation: Middleware = async ({ + client, + ack, + body, + respond, +}) => handleStopConversation({ client, ack, body, respond }); diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/shortcuts/index.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/shortcuts/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..a1d400df82bdcbe1a8749bded1b3ee3e7961bc2b --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/shortcuts/index.ts @@ -0,0 +1 @@ +export * from './summarizeThread'; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/shortcuts/summarizeThread.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/shortcuts/summarizeThread.ts new file mode 100644 index 0000000000000000000000000000000000000000..cffe2938e54819f25416539804fb1d4386ddc4a9 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/shortcuts/summarizeThread.ts @@ -0,0 +1,30 @@ +import { Middleware, SlackShortcutMiddlewareArgs } from '@slack/bolt'; + +import { handleSummarizeThread } from '../handlers'; + +export const summarizeThread: Middleware = async ({ + context, + shortcut, + ack, + client, + respond, +}) => { + await ack(); + + // Summarize shortcut is only available for message actions + if (shortcut.type !== 'message_action') return; + + const userId = shortcut.user.id; + // Start a new thread if the shortcut is used on the first message without any replies + const threadTs = shortcut.message.thread_ts || shortcut.message_ts; + const threadChannelId = shortcut.channel.id; + + await handleSummarizeThread({ + context, + client, + threadChannelId, + userId, + threadTs, + say: respond, + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/actions.test.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/actions.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..e4728203d8a63a918ea55189d8b8379b64b1d7ac --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/actions.test.ts @@ -0,0 +1,512 @@ +import { + AppMentionEvent, + BotMessageEvent, + Context, + FileShareMessageEvent, + GenericMessageEvent, +} from '@slack/bolt'; +import { afterEach, describe, expect, test, vi } from 'vitest'; + +import { SlackMessages, determineAction } from './actions'; + +// Mock database calls +// the whole file needs to be mocked to avoid importing/executing the index file +vi.mock('./getChannelSettings', () => { + return { + getChannelSettings: async (args: { + teamId: string | undefined; + enterpriseId: string | undefined; + channelId: string; + }) => { + return { + tools: args.teamId === 'tool-enabled-team' ? ['test-tool'] : [], + }; + }, + }; +}); + +const mockContext: Context = { + isEnterpriseInstall: false, + teamId: 'cohere-team', + enterpriseId: 'cohere-enterprise', + channelId: 'test', +}; + +describe('determineAction', () => { + afterEach(() => { + vi.clearAllMocks(); + vi.resetAllMocks(); + }); + + test('Ignores BotMessageEvent with unknown bot_id', async () => { + const event: BotMessageEvent = { + type: 'message', + subtype: 'bot_message', + event_ts: '1', + channel: 'test', + channel_type: 'channel', + ts: '1', + text: 'I am a bot', + bot_id: 'test', + }; + const action = await determineAction(mockContext, event); + expect(action.type).toBe('ignore'); + }); + + test('BotMessageEvent with whitelisted bot_id is not ignored', async () => { + vi.stubEnv('ALLOWED_BOT_IDS', 'allowed-bot-id'); + + const event: BotMessageEvent = { + type: 'message', + subtype: 'bot_message', + event_ts: '1', + channel: 'test', + channel_type: 'channel', + ts: '1', + text: 'I am a bot', + bot_id: 'allowed-bot-id', + }; + const action = await determineAction(mockContext, event); + expect(action.type).toBe('chat'); + + vi.unstubAllEnvs(); + }); + + test('BotMessageEvent with not whitelisted bot_id is ignored', async () => { + vi.stubEnv('ALLOWED_BOT_IDS', 'allowed-bot-id'); + + const event: BotMessageEvent = { + type: 'message', + subtype: 'bot_message', + event_ts: '1', + channel: 'test', + channel_type: 'channel', + ts: '1', + text: 'I am a bot', + bot_id: 'not-allowed-bot-id', + }; + const action = await determineAction(mockContext, event); + expect(action.type).toBe('ignore'); + + vi.unstubAllEnvs(); + }); + + test('Ignores GenericMessageEvent with a bot_id', async () => { + const event: GenericMessageEvent = { + type: 'message', + subtype: undefined, + event_ts: '1', + channel: 'test', + user: 'U05LUQL8X2R', + ts: '2', + channel_type: 'channel', + bot_id: 'bot', + }; + const action = await determineAction(mockContext, event); + expect(action.type).toBe('ignore'); + }); + + test('Ignores GenericMessageEvent with no content', async () => { + const event: GenericMessageEvent = { + type: 'message', + subtype: undefined, + event_ts: '1', + channel: 'test', + user: 'U05LUQL8X2R', + ts: '2', + channel_type: 'channel', + }; + const action = await determineAction(mockContext, event); + expect(action.type).toBe('ignore'); + }); + + test('Ignores AppMentionEvent with no content', async () => { + const event: AppMentionEvent = { + type: 'app_mention', + username: 'test', + text: '', + ts: 'test', + channel: 'test', + event_ts: 'test', + }; + const action = await determineAction(mockContext, event); + expect(action.type).toBe('ignore'); + }); + + test('FileShareMessageEvent events with `summarize` in the message text are marked as `file-summarize`', async () => { + const event: FileShareMessageEvent = { + type: 'message', + subtype: 'file_share', + text: 'summarize this file', + user: 'U05LUQL8X2R', + ts: '2', + channel: 'test', + channel_type: 'channel', + event_ts: '2', + files: [ + { + name: 'test-file', + title: 'test-file', + external_type: '', + username: 'test-user', + channels: [], + groups: [], + id: 'test-file', + created: 1, + mimetype: 'application/pdf', + filetype: 'pdf', + pretty_type: 'pdf', + editable: false, + size: 10, + mode: 'hosted', + is_external: false, + is_public: false, + public_url_shared: false, + display_as_bot: false, + permalink: 'url', + url_private: 'url', + }, + ], + }; + const action = await determineAction(mockContext, event); + expect(action.type).toBe('file-summarize'); + }); + + test('GenericMessageEvent events with a file in the message history and with `summarize` in the message text are marked as `file-summarize`', async () => { + const event: GenericMessageEvent = { + type: 'message', + text: 'summarize the file in this thread', + subtype: undefined, + event_ts: '1', + channel: 'test', + user: 'U05LUQL8X2R', + ts: '2', + channel_type: 'channel', + }; + + const messages: SlackMessages = [ + { + files: [ + { + name: 'test-file', + title: 'test-file', + external_type: '', + username: 'test-user', + channels: [], + groups: [], + id: 'test-file', + created: 1, + mimetype: 'application/pdf', + filetype: 'pdf', + pretty_type: 'pdf', + editable: false, + size: 10, + mode: 'hosted', + is_external: false, + is_public: false, + public_url_shared: false, + display_as_bot: false, + permalink: 'url', + url_private: 'url', + }, + ], + }, + ]; + const action = await determineAction(mockContext, event, messages); + expect(action.type).toBe('file-summarize'); + }); + + test('FileShareMessageEvent events are marked as `file-rag`', async () => { + const event: FileShareMessageEvent = { + type: 'message', + subtype: 'file_share', + text: 'question about this file?', + user: 'U05LUQL8X2R', + ts: '2', + channel: 'test', + channel_type: 'channel', + event_ts: '2', + files: [ + { + name: 'test-file', + title: 'test-file', + external_type: '', + username: 'test-user', + channels: [], + groups: [], + id: 'test-file', + created: 1, + mimetype: 'application/pdf', + filetype: 'pdf', + pretty_type: 'pdf', + editable: false, + size: 10, + mode: 'hosted', + is_external: false, + is_public: false, + public_url_shared: false, + display_as_bot: false, + permalink: 'url', + url_private: 'url', + }, + ], + }; + const action = await determineAction(mockContext, event); + expect(action.type).toBe('file-rag'); + }); + + test('GenericMessageEvent with a file in the message history are marked as `file-rag`', async () => { + const event: GenericMessageEvent = { + type: 'message', + text: 'who wrote this paper?', + subtype: undefined, + event_ts: '1', + channel: 'test', + user: 'U05LUQL8X2R', + ts: '2', + channel_type: 'channel', + }; + + const messages: SlackMessages = [ + { + files: [ + { + name: 'test-file', + title: 'test-file', + external_type: '', + username: 'test-user', + channels: [], + groups: [], + id: 'test-file', + created: 1, + mimetype: 'application/pdf', + filetype: 'pdf', + pretty_type: 'pdf', + editable: false, + size: 10, + mode: 'hosted', + is_external: false, + is_public: false, + public_url_shared: false, + display_as_bot: false, + permalink: 'url', + url_private: 'url', + }, + ], + }, + ]; + + const action = await determineAction(mockContext, event, messages); + expect(action.type).toBe('file-rag'); + }); + + test('GenericMessageEvent with context are marked as `chat`', async () => { + const event: GenericMessageEvent = { + type: 'message', + text: 'I have a question...', + subtype: undefined, + event_ts: '1', + channel: 'test', + user: 'U05LUQL8X2R', + ts: '2', + channel_type: 'channel', + }; + const action = await determineAction(mockContext, event); + expect(action.type).toBe('chat'); + }); + + test('AppMentionEvent with context are marked as `chat`', async () => { + const event: AppMentionEvent = { + type: 'app_mention', + username: 'test', + text: 'hello', + ts: 'test', + channel: 'test', + event_ts: 'test', + }; + const action = await determineAction(mockContext, event); + expect(action.type).toBe('chat'); + }); + + test('FileShareMessageEvent events with `summarize` in the message text and an invalid file are marked as `file-invalid`', async () => { + const event: FileShareMessageEvent = { + type: 'message', + subtype: 'file_share', + text: 'summarize this file', + user: 'U05LUQL8X2R', + ts: '2', + channel: 'test', + channel_type: 'channel', + event_ts: '2', + files: [ + { + name: 'test-file', + title: 'test-file', + external_type: '', + username: 'test-user', + channels: [], + groups: [], + id: 'test-file', + created: 1, + mimetype: 'application/invalid', + filetype: 'invalid', + pretty_type: 'invalid', + editable: false, + size: 10, + mode: 'hosted', + is_external: false, + is_public: false, + public_url_shared: false, + display_as_bot: false, + permalink: 'url', + url_private: 'url', + }, + ], + }; + const action = await determineAction(mockContext, event); + expect(action.type).toBe('file-invalid'); + }); + + test('FileShareMessageEvent events with an invalid file are marked as `file-invalid`', async () => { + const event: FileShareMessageEvent = { + type: 'message', + subtype: 'file_share', + text: 'question about this file?', + user: 'U05LUQL8X2R', + ts: '2', + channel: 'test', + channel_type: 'channel', + event_ts: '2', + files: [ + { + name: 'test-file', + title: 'test-file', + external_type: '', + username: 'test-user', + channels: [], + groups: [], + id: 'test-file', + created: 1, + mimetype: 'application/invalid', + filetype: 'invalid', + pretty_type: 'invalid', + editable: false, + size: 10, + mode: 'hosted', + is_external: false, + is_public: false, + public_url_shared: false, + display_as_bot: false, + permalink: 'url', + url_private: 'url', + }, + ], + }; + const action = await determineAction({ ...mockContext, teamId: 'rag-enabled-team' }, event); + expect(action.type).toBe('file-invalid'); + }); + + test('FileShareMessageEvent events with `summarize` in the message text and a file with no url_private are marked as `file-invalid`', async () => { + const event: FileShareMessageEvent = { + type: 'message', + subtype: 'file_share', + text: 'summarize this file', + user: 'U05LUQL8X2R', + ts: '2', + channel: 'test', + channel_type: 'channel', + event_ts: '2', + files: [ + { + name: 'test-file', + title: 'test-file', + external_type: '', + username: 'test-user', + channels: [], + groups: [], + id: 'test-file', + created: 1, + mimetype: 'application/pdf', + filetype: 'pdf', + pretty_type: 'pdf', + editable: false, + size: 10, + mode: 'hosted', + is_external: false, + is_public: false, + public_url_shared: false, + display_as_bot: false, + permalink: 'url', + }, + ], + }; + const action = await determineAction(mockContext, event); + expect(action.type).toBe('file-invalid'); + }); + + test('FileShareMessageEvent events with a file with no url_private are marked as `chat`', async () => { + const event: FileShareMessageEvent = { + type: 'message', + subtype: 'file_share', + text: 'question about this file?', + user: 'U05LUQL8X2R', + ts: '2', + channel: 'test', + channel_type: 'channel', + event_ts: '2', + files: [ + { + name: 'test-file', + title: 'test-file', + external_type: '', + username: 'test-user', + channels: [], + groups: [], + id: 'test-file', + created: 1, + mimetype: 'application/pdf', + filetype: 'pdf', + pretty_type: 'pdf', + editable: false, + size: 10, + mode: 'hosted', + is_external: false, + is_public: false, + public_url_shared: false, + display_as_bot: false, + permalink: 'url', + }, + ], + }; + const action = await determineAction({ ...mockContext, teamId: 'rag-enabled-team' }, event); + expect(action.type).toBe('file-invalid'); + }); + + test('GenericMessageEvent with tools enabled are marked as `chat-rag`', async () => { + const event: GenericMessageEvent = { + type: 'message', + text: 'I have a question...', + subtype: undefined, + event_ts: '1', + channel: 'test', + user: 'U05LUQL8X2R', + ts: '2', + channel_type: 'channel', + }; + const action = await determineAction({ ...mockContext, teamId: 'tool-enabled-team' }, event); + expect(action.type).toBe('chat-rag'); + }); + + test('AppMentionEvent with tools enabled are marked as `chat-rag`', async () => { + const event: AppMentionEvent = { + type: 'app_mention', + username: 'test', + text: 'hello', + ts: 'test', + channel: 'test', + event_ts: 'test', + }; + const action = await determineAction({ ...mockContext, teamId: 'tool-enabled-team' }, event); + expect(action.type).toBe('chat-rag'); + }); +}); diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/actions.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/actions.ts new file mode 100644 index 0000000000000000000000000000000000000000..1ce5d30f238f3ce6126395700d38a6c636b43a3d --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/actions.ts @@ -0,0 +1,157 @@ +import { + AppMentionEvent, + BotMessageEvent, + Context, + FileShareMessageEvent, + GenericMessageEvent, + MessageEvent, +} from '@slack/bolt'; +import { ConversationsRepliesResponse } from '@slack/web-api'; + +import { Tool } from '../cohere-client'; +import { ACCEPTABLE_RAG_CHAT_FILE_TYPES, ACCEPTABLE_SUMMARIZE_FILE_TYPES } from '../constants'; +import { SlackFile } from './files'; +import { getChannelSettings } from './getChannelSettings'; + +export type SlackMessages = ConversationsRepliesResponse['messages']; + +export type ActionEventTypes = AppMentionEvent | FileShareMessageEvent | GenericMessageEvent; + +export type Action = + | { type: 'chat'; event: ActionEventTypes } + | { type: 'chat-rag'; event: ActionEventTypes; tools: Tool[] } + | { + type: 'file-summarize'; + event: ActionEventTypes; + file: SlackFile; + } + | { + type: 'file-rag'; + event: ActionEventTypes; + file: SlackFile; + } + | { + type: 'file-invalid'; + event: ActionEventTypes; + originalAction: 'file-summarize' | 'file-rag'; + } + | { type: 'ignore'; event: unknown }; + +export type ValidAction = Exclude; + +/** + * Custom Type guards for Slack Events + */ +export const isFileShareEvent = ( + event: MessageEvent | AppMentionEvent, +): event is FileShareMessageEvent => { + return ( + !!(event as FileShareMessageEvent).files || + (event.type === 'message' && event.subtype === 'file_share') + ); +}; + +export const isAppMentionEvent = ( + event: MessageEvent | AppMentionEvent, +): event is AppMentionEvent => { + return event.type === 'app_mention'; +}; + +const isGenericMessageEvent = ( + event: MessageEvent | AppMentionEvent, +): event is GenericMessageEvent => { + return event.type === 'message' && event.subtype === undefined; +}; + +const isBotMessageEvent = (event: MessageEvent | AppMentionEvent): event is BotMessageEvent => { + return event.type === 'message' && event.subtype === 'bot_message'; +}; + +const isUnknownBotMessageEvent = ( + event: MessageEvent | AppMentionEvent, +): event is BotMessageEvent => { + const botId = (event as BotMessageEvent).bot_id; + if (!botId) return false; // No bot id means it's not a bot message + + const validBotIds = process.env.ALLOWED_BOT_IDS?.split(',') ?? []; + const isValidBotId = validBotIds.includes((event as BotMessageEvent).bot_id); + if (isValidBotId) return false; // If the bot id is valid, it's not an unknown bot + + return isBotMessageEvent(event); +}; + +/** + * Determine the appropriate action based on the incoming slack event + * and handle checks to ensure incompatible events are ignored + */ +export const determineAction = async ( + context: Context, + event: MessageEvent | AppMentionEvent, + messages: SlackMessages = [], +): Promise => { + // never respond to unknown bots + if (isUnknownBotMessageEvent(event)) return { type: 'ignore', event }; + + // only support app mentions, file shares, bot, and generic messages + // bot messages are allowed because all bot messages that reach this point are approved + if ( + !isAppMentionEvent(event) && + !isGenericMessageEvent(event) && + !isFileShareEvent(event) && + !isBotMessageEvent(event) + ) { + return { type: 'ignore', event }; + } + + // if the message is empty, ignore the event + if (event.text === undefined || event.text === '') return { type: 'ignore', event }; + + // check if the event has a file or if there is a file in the history + const eventFile = (event as FileShareMessageEvent).files?.[0]; + const file = eventFile || messages.find((m) => !!m.files)?.files?.[0]; + + if (file) { + const isUploadEvent = eventFile === file; + const shouldSummarize = event.text?.includes('summarize'); + const isValidSummarizeFile = + file?.url_private && ACCEPTABLE_SUMMARIZE_FILE_TYPES.has(file.filetype ?? 'unknown'); + const isValidRagFile = + file?.url_private && ACCEPTABLE_RAG_CHAT_FILE_TYPES.has(file.filetype ?? 'unknown'); + + if (shouldSummarize) { + if (isValidSummarizeFile) { + return { type: 'file-summarize', event, file }; + } + // If the file is not a valid for summarization, default to chat, returning an error if the file was just uploaded + return isUploadEvent + ? { type: 'file-invalid', event, originalAction: 'file-summarize' } + : { type: 'chat', event }; + } + + if (isValidRagFile) { + return { type: 'file-rag', event, file }; + } + + // If the file is not a valid for rag chat, default to chat, returning an error if the file was just uploaded + return isUploadEvent + ? { type: 'file-invalid', event, originalAction: 'file-rag' } + : { type: 'chat', event }; + } + + // Check if tools are enabled + const { tools } = await getChannelSettings({ + teamId: context.teamId, + enterpriseId: context.enterpriseId, + channelId: event.channel, + }); + + if (tools.length > 0) { + return { + type: 'chat-rag', + event, + tools, + }; + } + // default to chat + return { type: 'chat', event }; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/files.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/files.ts new file mode 100644 index 0000000000000000000000000000000000000000..4833ccaea07bf4ff7fbf9888eff7dd0f0b0c95e7 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/files.ts @@ -0,0 +1,81 @@ +import { FileShareMessageEvent } from '@slack/bolt'; +import { FileElement } from '@slack/web-api/dist/response/ConversationsRepliesResponse'; +import * as pdfjs from 'pdfjs-dist'; +import { TextItem } from 'pdfjs-dist/types/src/display/api'; +import WORDEXTRACTOR from 'word-extractor'; + +export type SlackFile = Exclude[number] | FileElement; + +export type PageText = { + text: string; + pageNumber: number; +}; + +const getPDFText = async (fileData: ArrayBuffer): Promise => { + const pageTexts = await getPdfPageTexts(fileData); + + return pageTexts.map((p) => p.text).join(' '); +}; + +const getPdfPageTexts = async (fileData: ArrayBuffer): Promise => { + const pdfDocument = await pdfjs.getDocument({ data: fileData, useSystemFonts: true }).promise; + const pageNumbers = [...Array(pdfDocument.numPages + 1).keys()].splice(1); + + const pageTexts = await Promise.all( + pageNumbers.map(async (pageNumber) => { + const page = await pdfDocument.getPage(pageNumber); + const tokenizedText = await page.getTextContent(); + const text = tokenizedText.items.map((token) => (token as TextItem).str).join(' '); + return { + text, + pageNumber, + }; + }), + ); + + return pageTexts; +}; + +const getDocText = async (fileData: Buffer): Promise => { + const extractor = new WORDEXTRACTOR(); + const extracted = await extractor.extract(fileData); + return extracted.getBody(); +}; + +const getSafeFileBuffer = (data: ArrayBuffer): Buffer => { + // Anti-corruption layer + const temp = Buffer.alloc(data.byteLength); + const view = Buffer.from(data); + view.copy(temp); + + return view; +}; + +/** + * Given an input file buffer return the entire content of the file as a string + */ +export const getFileRawText = async (file: SlackFile, buffer: ArrayBuffer): Promise => { + switch (file.filetype) { + case 'pdf': + return getPDFText(buffer); + case 'doc': + case 'docx': + return getDocText(getSafeFileBuffer(buffer)); + case 'text': + return getSafeFileBuffer(buffer).toString('utf8'); + default: + throw new Error('Unsupported file type'); + } +}; + +/** + * Given an input file buffer return the content of the file as chunks broken down by page + */ +export const getFileChunks = async (file: SlackFile, buffer: ArrayBuffer): Promise => { + switch (file.filetype) { + case 'pdf': + return await getPdfPageTexts(buffer); + default: + throw new Error('Unsupported file type'); + } +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/formatRagCitations.test.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/formatRagCitations.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..85c5b4b154c3d21c6f44125e8ee839bf0d99bb1d --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/formatRagCitations.test.ts @@ -0,0 +1,137 @@ +import { describe, expect, test } from 'vitest'; + +import { formatRagCitations } from './formatRagCitations'; + +describe('formatRagCitations', () => { + test('format RAG response into a list of bullet points, each as a slack link using the citation title + url', () => { + const chatResponse = { + response_id: 'aef874ef-bc61-45aa-9ade-4efac4fb12d3', + conversation_id: '1705939582_599929-C05M1US4SSX', + text: 'The following are some of the most popular programming languages in the world:\n\n- Python\n- TypeScript\n\nAre you looking to become a programmer?', + generation_id: '12345678-30db-4d7d-a60a-d58cc7daa366', + citations: [ + { + start: 42, + end: 67, + text: 'Everything about Python', + document_ids: ['elastic-search-slack-v1-0bdrwb_1', 'elastic-search-slack-v1-0bdrwb_3'], + }, + { + start: 70, + end: 109, + text: 'All about TypeScript', + document_ids: ['elastic-search-slack-v1-0bdrwb_1', 'elastic-search-slack-v1-0bdrwb_0'], + }, + ], + documents: [ + { + document_id: 'elastic-search-slack-v1-0bdrwb_1', + snippet: 'Python 3.12 is fast!', + title: 'Python', + url: 'https://example.slack.com/archives/ask-programmers/p1699027927.191979?thread_ts=1699026229.534229', + text: '', + tool_name: '', + fields: {}, + }, + { + document_id: 'elastic-search-slack-v1-0bdrwb_3', + snippet: 'Another popular language for frontend programming is TypeScript.', + title: 'TypeScript', + url: 'https://example.slack.com/archives/ask-programmers/p1698415906.928069?thread_ts=1698354798.078099', + text: '', + tool_name: '', + fields: {}, + }, + ], + is_finished: true, + finish_reason: '', + chat_history: [], + }; + const formattedCitations = formatRagCitations(chatResponse); + expect(formattedCitations).toEqual(` +*Sources:* +- +- `); + }); + + test('combine duplicate RAG response links into one citation and exclude documents that are not cited', () => { + const chatResponse = { + response_id: '00000000-0000-0000-0000-00000000001', + conversation_id: '000000000_000000-000000012345', + text: 'Here are some programming languages you could use to build a webapp. \n\n- Python\n\n- Ruby\n\n- TypeScript\n\nDo you want me to provide more information about any of these languages?', + generation_id: '0000000-0000-0000-0000-12300000000', + citations: [ + { + start: 83, + end: 96, + text: 'TypeScript', + document_ids: ['test-document-id-1'], + }, + { + start: 98, + end: 114, + text: 'Javascript', + document_ids: ['test-document-id-1'], + }, + { + start: 118, + end: 136, + text: 'TypeScript and Javascript are both used with Node applications', + document_ids: ['test-document-id-1'], + }, + ], + documents: [ + { + document_id: 'test-document-id-1', + snippet: 'All about TypeScript and Javascript', + title: 'TypeScript and Javascript Programming', + url: 'https://example.com/typescript-and-javascript', + text: '', + tool_name: '', + fields: {}, + }, + { + document_id: 'test-document-id-2', + snippet: 'Python can be used for web APIs', + title: 'About Python', + url: 'https://example.com/python', + text: '', + tool_name: '', + fields: {}, + }, + { + document_id: 'test-document-id-3', + snippet: 'Java', + title: 'About Java', + url: 'https://example.com/java', + text: '', + tool_name: '', + fields: {}, + }, + ], + finish_reason: '', + is_finished: true, + chat_history: [], + }; + + const formattedCitations = formatRagCitations(chatResponse); + expect(formattedCitations).toEqual(` +*Sources:* +- `); + }); + + test('safely handles RAG response with not citation', () => { + const chatResponse = { + response_id: '00000000-0000-0000-0000-00000000001', + conversation_id: '000000000_000000-000000012345', + text: 'I could not find any information.', + generation_id: '0000000-0000-0000-0000-12300000000', + is_finished: true, + finish_reason: '', + chat_history: [], + }; + + const formattedCitations = formatRagCitations(chatResponse); + expect(formattedCitations).toEqual(``); + }); +}); diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/formatRagCitations.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/formatRagCitations.ts new file mode 100644 index 0000000000000000000000000000000000000000..c5982b1ecd403a59b331dc37c843d5f6234677d9 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/formatRagCitations.ts @@ -0,0 +1,34 @@ +import { ALERTS } from 'src/constants'; + +import { Document, NonStreamedChatResponse } from '../cohere-client'; + +export const formatRagCitations = ( + chatResponse: NonStreamedChatResponse, + prefix = ALERTS.RAG_SOURCES_PREFIX, +): string => { + // find set of documents that are actually cited + const sources = new Set((chatResponse.citations ?? []).map((c) => c.document_ids).flat()); + + // dedupe citations by url + const citations = Object.values( + (chatResponse.documents ?? []) + .filter((d) => sources.has(d.document_id)) + .reduce((acc: { [key: string]: Document }, d) => { + if (d.url) { + acc[d.url] = d; + } + return acc; + }, {}), + ); + + // safely handle when no citations are found + if (citations.length === 0) { + return ''; + } + + // basic formatting for slack (bullet point with link) + const formattedCitations = citations + .map((d) => (d.title ? `- <${d.url}|${d.title}>` : `- ${d.url}`)) + .join('\n'); + return `\n${prefix}\n${formattedCitations}`; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getChannelSettings.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getChannelSettings.ts new file mode 100644 index 0000000000000000000000000000000000000000..8f9fca7d6793cd3f72740e94fac96cbf5a51a4a2 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getChannelSettings.ts @@ -0,0 +1,69 @@ +import { ChannelSettings as ChannelSettingsPrisma } from '@prisma/client'; + +import { prisma } from '..'; +import { Tool } from '../cohere-client'; + +type GetChannelSettingsArgs = { + teamId: string | undefined; + enterpriseId: string | undefined; + channelId: string; +}; + +type ChannelSettings = { + deployment: string | null; + model: string | null; + temperature: number | null; + preambleOverride: string | null; + tools: Tool[]; +}; + +const getChannelSettingsPrisma = async ({ + teamId, + enterpriseId, + channelId, +}: GetChannelSettingsArgs): Promise => { + const workspaceSettings = await prisma.workspaceSettings.upsert({ + create: { teamId, enterpriseId }, + update: {}, + where: { teamId, enterpriseId }, + include: { + channelSettings: true, + }, + }); + + return workspaceSettings.channelSettings.find((set) => set.channelId === channelId); +}; + +export const getChannelSettings = async ({ + teamId, + enterpriseId, + channelId, +}: GetChannelSettingsArgs): Promise => { + const defaultSettings: ChannelSettings = { + deployment: null, // Leave to API default, + model: null, // Leave to API default + temperature: null, // Leave to API default + preambleOverride: null, // Leave to API default + tools: [], + }; + + if (!prisma) return defaultSettings; + + const channelSettings = await getChannelSettingsPrisma({ + teamId, + enterpriseId, + channelId, + }); + + if (!channelSettings) return defaultSettings; + + const formattedTools = channelSettings?.tools && channelSettings?.tools.map((t) => ({ name: t })); + + return { + deployment: channelSettings.deployment || defaultSettings.deployment, + model: channelSettings.modelName || defaultSettings.model, + temperature: channelSettings.temperature || defaultSettings.temperature, + preambleOverride: channelSettings.preamble || defaultSettings.preambleOverride, + tools: formattedTools || defaultSettings.tools, + }; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getConversationId.test.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getConversationId.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..7583f4f0de3a9df18cb10478c2c958d863d4838e --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getConversationId.test.ts @@ -0,0 +1,31 @@ +import { expect, test } from 'vitest'; + +import { getConversationId } from './getConversationId'; + +test('All parameters provided', async () => { + const threadTs = '1623345678.123214'; + const channelId = 'C03SMGA4P62'; + const { conversationId } = getConversationId({ threadTs, channelId }); + expect(conversationId).toBe('1623345678_123214-C03SMGA4P62'); +}); + +test('No threadTs provided', async () => { + const threadTs = ''; + const channelId = 'C03SMGA4P62'; + const { conversationId } = getConversationId({ threadTs, channelId }); + expect(conversationId).toBe(undefined); +}); + +test('No channelId provided', async () => { + const threadTs = '1623345678.123214'; + const channelId = ''; + const { conversationId } = getConversationId({ threadTs, channelId }); + expect(conversationId).toBe(undefined); +}); + +test('No params provided', async () => { + const threadTs = ''; + const channelId = ''; + const { conversationId } = getConversationId({ threadTs, channelId }); + expect(conversationId).toBe(undefined); +}); diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getConversationId.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getConversationId.ts new file mode 100644 index 0000000000000000000000000000000000000000..29b68455c455c6a7236a6ace0dda3f911ce67d32 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getConversationId.ts @@ -0,0 +1,26 @@ +type GetConversationIdArgs = { + threadTs: string; + channelId: string; +}; + +type ConversationId = { + conversationId: string | undefined; +}; + +/** + * A consistent conversation ID is needed to + * maintain context on the chat endpoint logs for analytics. + * This function generates a conversation ID based on the thread + * timestamp (parent message) and channel ID + * */ +export const getConversationId = ({ + threadTs, + channelId, +}: GetConversationIdArgs): ConversationId => { + if (threadTs === '' || channelId === '') { + return { conversationId: undefined }; + } + const tsWithoutDecimal = threadTs.replace('.', '_'); + const conversationId = `${tsWithoutDecimal}-${channelId}`; + return { conversationId }; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getMessageBlocks.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getMessageBlocks.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d8c11cb4fc8f2320c7e88b695e4027cc770ad18 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getMessageBlocks.ts @@ -0,0 +1,99 @@ +import { Block, KnownBlock } from '@slack/bolt'; + +type GetEphemeralBlockArgs = { + text: string; + isDismissible?: boolean; +}; + +type GetFeedbackBlocksArgs = { + responseID: string; + threadTs: string; +}; + +type BlockArr = Array; +/** + * Ephemeral (ghost message that is only visible to the user) block that can have an optional dismiss button + * This can be used in the built in say/respond functions and the postEphemeral function + * Provide the output of this as the blocks property when making a call. + * Use this to avoid code repetition of these block elements. + */ + +export const getEphemeralBlocks = ({ + text, + isDismissible = true, +}: GetEphemeralBlockArgs): BlockArr => { + return isDismissible + ? [ + { + type: 'section', + text: { + type: 'mrkdwn', + text, + }, + }, + { + type: 'actions', + elements: [ + { + type: 'button', + action_id: 'dismiss_ephemeral', + text: { + type: 'plain_text', + emoji: true, + text: 'Dismiss', + }, + value: 'dismiss', + }, + ], + }, + ] + : [ + { + type: 'section', + text: { + type: 'mrkdwn', + text, + }, + }, + ]; +}; + +export const getContentBlocks = (text: string): BlockArr => { + if (text.length > 3000) { + throw new Error(`getContentBlocks: text length ${text.length} exceeds 3000 character limit`); + } + + return [ + { + type: 'section', + text: { + type: 'mrkdwn', + text, + }, + }, + ]; +}; + +/** + * Defines the feedback blocks used for bot responses. + * Provide the output of this as the blocks property when making a call. + */ +export const getFeedbackBlocks = ({ threadTs }: GetFeedbackBlocksArgs): BlockArr => { + return [ + { + type: 'actions', + elements: [ + { + type: 'button', + action_id: 'stop_conversation', + text: { + type: 'plain_text', + emoji: true, + text: ':shushing_face:', + }, + value: `stop-${threadTs}`, + }, + ], + }, + ]; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getReply.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getReply.ts new file mode 100644 index 0000000000000000000000000000000000000000..393858daf6f8a7ea2d266a46b9dc8f5b48551426 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getReply.ts @@ -0,0 +1,89 @@ +import { AllMiddlewareArgs, AppMentionEvent, MessageEvent } from '@slack/bolt'; + +import { ApiError, CohereChatRequest, OpenAPI, Tool, ToolkitClient } from '../cohere-client'; +import { DEPLOYMENT_COHERE_PLATFORM, ERRORS } from '../constants'; +import { formatRagCitations } from './formatRagCitations'; +import { getSanitizedMessage } from './getSanitizedMessage'; +import { GetUsersRealNameArgs, getUsersRealName } from './getUsersRealName'; + +type GetReplyArgs = Pick & { + event: MessageEvent | AppMentionEvent; + tools?: Tool[]; + deployment?: string | null; + model?: string | null; + temperature?: number | null; + preambleOverride?: string | null; + conversationId: string | undefined; + botUserId?: string; + isFirstMessage?: boolean; +}; + +type Reply = { + currentBotReply: string; + responseID: string; + errorMessage?: string; +}; + +/** + * Fetches a reply using the /chat endpoint given a + * slack event (that will contain the message text) + */ + +export const getReply = async ({ + event, + deployment, + model, + client, + conversationId, + botUserId, + tools = [], + temperature = null, + preambleOverride = null, + isFirstMessage = false, +}: GetReplyArgs): Promise => { + /** + * Since we filter out edited messages in the message event listener, + * and the property we're looking for is present in both MessageEvent and AppMentionEvent, + * we can safely cast the event as AppMentionEvent + */ + event = event as AppMentionEvent; + const messageWithoutUsername = await getSanitizedMessage({ + message: event.text, + getUsersRealName: async ({ userId }: GetUsersRealNameArgs) => + getUsersRealName({ userId, client }), + botUserId, + isFirstMessage, + }); + + const params: CohereChatRequest = { + message: messageWithoutUsername, + conversation_id: conversationId, + prompt_truncation: 'AUTO_PRESERVE_ORDER', + }; + + if (model && model !== 'default') params.model = model; + if (temperature) params.temperature = temperature; + if (preambleOverride) params.preamble = preambleOverride; + if (tools.length > 0) params.tools = tools; + + try { + const toolkitClient = new ToolkitClient(OpenAPI); + const chatResponse = await toolkitClient.default.chatV1ChatPost({ + requestBody: params, + deploymentName: deployment ? deployment : DEPLOYMENT_COHERE_PLATFORM, + }); + const sanitizedBotReply = await getSanitizedMessage({ + message: chatResponse.text, + getUsersRealName: async ({ userId }: GetUsersRealNameArgs) => + getUsersRealName({ userId, client }), + }); + + const botReply = sanitizedBotReply + formatRagCitations(chatResponse); + return { currentBotReply: botReply, responseID: chatResponse.generation_id || '' }; + } catch (error: any) { + if (error instanceof ApiError) { + return { currentBotReply: '', responseID: '', errorMessage: error.message }; + } + return { currentBotReply: '', responseID: '', errorMessage: ERRORS.GENERAL }; + } +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getSanitizedConversationHistory.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getSanitizedConversationHistory.ts new file mode 100644 index 0000000000000000000000000000000000000000..b3e3857ad46f1f8db1ce43794ed4fde7fec74be1 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getSanitizedConversationHistory.ts @@ -0,0 +1,193 @@ +import { AllMiddlewareArgs, AppMentionEvent, Context, MessageEvent } from '@slack/bolt'; + +import { ALERTS, STOP_REPLYING_MESSAGE } from '../constants'; +import { getSanitizedMessage } from './getSanitizedMessage'; +import { GetUsersRealNameArgs, getUsersRealName } from './getUsersRealName'; + +type Message = MessageEvent | AppMentionEvent; + +type ChatlogMessage = { + user_name: string; + message: string; +}; + +type GetSanitizedConversationHistoryArgs = Pick & { + context: Context; + messageHistory: Array; + format?: 'object' | 'string'; + isDM?: boolean; +}; + +type SanitizedConversationHistoryArray = { + sanitizedConversationHistory: Array; + sanitizedConversationHistoryString?: string; +}; + +type SanitizedConversationHistoryString = { + sanitizedConversationHistory?: Array; + sanitizedConversationHistoryString: string; +}; + +type SanitizedConversationHistory = { + hasStopReplyingCommand: boolean; + hasBotAckStopReplyingCommand: boolean; +} & (SanitizedConversationHistoryArray | SanitizedConversationHistoryString); + +/** + * Accepts a slack formatted message history and re-formats + * it in a way that can be used for /chat endpoint or /summarize endpoint + */ +export const getSanitizedConversationHistory = async ({ + context, + client, + messageHistory, + format = 'object', + isDM = false, +}: GetSanitizedConversationHistoryArgs): Promise => { + const botUserId = context.botUserId; + const botId = context.botId; + + const hasStopReplyingCommand = messageHistory.some( + (msg: any) => + msg.text.includes(`<@${botUserId}> chill`) || + msg.text.toLowerCase().includes('command chill'), + ); + + const hasBotAckStopReplyingCommand = messageHistory.some( + (msg: any) => msg.user === botUserId && msg.text === STOP_REPLYING_MESSAGE, + ); + + // Exclude all bot messages that aren't command + const userAndCommandMessages = messageHistory.filter( + (msg: Message) => + (msg.subtype === 'bot_message' && msg.bot_id !== botId) || msg.subtype !== 'bot_message', + ); + + // Get all the usernames in the conversation + const usernames: { [key: string]: string } = {}; + for (let msg of userAndCommandMessages) { + /** + * Since user exists on both AppMentionEvent and MessageEvent, + * we can safely cast to AppMentionEvent to avoid TS errors + */ + msg = msg as AppMentionEvent; + if (msg.user && !usernames[msg.user]) { + const userInfo = await client.users.info({ + user: msg.user, + }); + + usernames[msg.user] = userInfo.user?.profile?.display_name ?? 'user'; + } + } + + const chunkedMarkerRegex = /(\[\d+\/\d+\] )/g; + + const userAndCommandMessagesWithoutChunkedMarkers = userAndCommandMessages.map((msg: any) => { + if (msg.text) { + msg.text = msg.text.replaceAll(chunkedMarkerRegex, ''); + } + + for (const block of msg.blocks || []) { + if (block.type !== 'section' || block.text.type !== 'mrkdwn') continue; + block.text.text = block.text.text.replaceAll(chunkedMarkerRegex, ''); + } + + return msg; + }); + + // Used for summarize endpoint + if (format === 'string') { + // We don't want to include the previous summary in the convo when we make a new summary. + const userAndCommandMessagesWithoutSummaries = + userAndCommandMessagesWithoutChunkedMarkers.filter( + (msg: any) => !msg.text.includes(ALERTS.THREAD_SUMMARY_PREFIX), + ); + + const sanitizedConversationHistoryStringArr = await Promise.all( + userAndCommandMessagesWithoutSummaries.map(async (msg: any, index) => { + if (msg.user === botUserId) { + return `chatbot: ${msg.text}`; + } + const sanitizedMessage = await getSanitizedMessage({ + message: msg.text, + getUsersRealName: async ({ userId }: GetUsersRealNameArgs) => + getUsersRealName({ userId, client }), + botUserId, + isFirstMessage: !isDM && index === 0, + }); + return `${usernames[msg.user]}: ${sanitizedMessage}`; + }), + ); + + // Combine consecutive messages from the same username into one message + // This is to avoid breaking internal tools that expect one message per user per conversation turn + const combinedMessagesStringArr = sanitizedConversationHistoryStringArr.reduce((acc, curr) => { + let lastMessage = acc[acc.length - 1]; + + if (lastMessage && lastMessage.startsWith(curr.split(':')[0])) { + const currMsgTextWithoutUsername = curr.split(':').slice(1).join(':'); + // Directly mutate the last message in the array since JS/TS is pass-by-value + acc[acc.length - 1] = `${lastMessage}\n${currMsgTextWithoutUsername}`; + return acc; + } + + return [...acc, curr]; + }, [] as Array); + + const combinedMessagesString = combinedMessagesStringArr.join('\n'); + + return { + sanitizedConversationHistoryString: combinedMessagesString, + hasStopReplyingCommand, + hasBotAckStopReplyingCommand, + }; + } + + /** + * Follow the format /chat endpoint expects and remove the most recent message. + * The endpoint expects that as a separate argument. + */ + const sanitizedConversationHistory = await Promise.all( + userAndCommandMessagesWithoutChunkedMarkers + .map(async (msg: any, index) => { + // If there's a block with markdown, use that. Otherwise, use the non-markdown text + const originalMessage = msg.blocks?.[0]?.text?.text || msg.text; + + if (msg.user === botUserId || msg.subtype === 'bot_message') { + // remove any text related to RAG sources from the history + const msgWithoutSources = originalMessage.split(ALERTS.RAG_SOURCES_PREFIX)[0]; + return { user_name: 'Chatbot', message: msgWithoutSources }; + } + + const sanitizedMessage = await getSanitizedMessage({ + message: originalMessage, + getUsersRealName: async ({ userId }: GetUsersRealNameArgs) => + getUsersRealName({ userId, client }), + botUserId, + isFirstMessage: !isDM && index === 0, + }); + + return { user_name: 'User', message: sanitizedMessage }; + }) + .slice(0, -1), + ); + + // Combine consecutive messages from the same user into one message + // This is to avoid breaking internal tools that expect one message per user per conversation turn + const combinedMessages = sanitizedConversationHistory.reduce((acc, curr) => { + const lastMessage = acc[acc.length - 1]; + + if (lastMessage && lastMessage.user_name === curr.user_name) { + lastMessage.message = `${lastMessage.message}\n${curr.message}`; + return acc; + } + + return [...acc, curr]; + }, [] as Array); + + return { + sanitizedConversationHistory: combinedMessages, + hasStopReplyingCommand, + hasBotAckStopReplyingCommand, + }; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getSanitizedMessage.test.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getSanitizedMessage.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..5238c50b00a43561e2e18edcc99fba7aface963f --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getSanitizedMessage.test.ts @@ -0,0 +1,70 @@ +import { expect, test } from 'vitest'; + +import { getSanitizedMessage } from './getSanitizedMessage'; + +const REAL_NAME_OBJ: { [key: string]: string } = { + U0000000123: 'John Doe', + U0000000456: 'Richard Roe', + U0000000789: 'Jane Smith', + U059C8BPCP4: 'Command', +}; + +const getUsersRealName = ({ userId }: { userId: string }) => { + return REAL_NAME_OBJ[userId]; +}; +const sanitizeTestData = [ + ['Hi <@U0000000123>! How are you?', 'Hi John Doe! How are you?\n'], + [ + 'I, <@U0000000123>, am gonna have a chat with <@U0000000456> over in <#C000000ABC|command-slack-bot>', + 'I, John Doe, am gonna have a chat with Richard Roe over in #command-slack-bot\n', + ], + [ + "<@U0000000456>, will be working with <@U0000000789> on a future project, updates for which they'll provide in <#C0000000XYZ|updates>. They'll move updates to <#C03SMGA4P62|secret-project> once enough people have joined the channel.", + "Richard Roe, will be working with Jane Smith on a future project, updates for which they'll provide in #updates. They'll move updates to #secret-project once enough people have joined the channel.\n", + ], + [ + "This message doesn't have any mentions or channel links, so nothing should change.", + "This message doesn't have any mentions or channel links, so nothing should change.\n", + ], + [ + "Lets say this message has an @mention and #channel-name but it's not formatted in slack format. Nothing should change.", + "Lets say this message has an @mention and #channel-name but it's not formatted in slack format. Nothing should change.\n", + ], + [ + 'This has a non-existing user present, like <@U0000000ABC>, or <@BOB>. So it should remove them all together.', + 'This has a non-existing user present, like , or . So it should remove them all together.\n', + ], + [ + 'Check chars involved: < > # 5<6 6>5 #slackBot ', + 'Check chars involved: < > # 5<6 6>5 #slackBot \n', + ], +]; + +test.each(sanitizeTestData)('Sanitizes message correctly', async (input, expectedOutput) => { + expect( + await getSanitizedMessage({ + message: input, + getUsersRealName, + }), + ).toBe(expectedOutput); +}); + +const sanitizeFirstMessageTestData = [ + ['Hi <@U0000000123>! How are you?', 'Hi John Doe! How are you?\n'], + ['<@U059C8BPCP4> How are you?', 'How are you?\n'], + ['<@U059C8BPCP4> How is <@U059C8BPCP4>?', 'How is Command?\n'], +]; + +test.each(sanitizeFirstMessageTestData)( + 'Sanitizes first message correctly', + async (input, expectedOutput) => { + expect( + await getSanitizedMessage({ + message: input, + getUsersRealName, + botUserId: 'U059C8BPCP4', + isFirstMessage: true, + }), + ).toBe(expectedOutput); + }, +); diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getSanitizedMessage.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getSanitizedMessage.ts new file mode 100644 index 0000000000000000000000000000000000000000..4975c83e44e0f0c0dad16333aa6bb5be9881557a --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getSanitizedMessage.ts @@ -0,0 +1,56 @@ +import slackify from 'slackify-markdown'; + +type GetSanitizedMessageArgs = { + message: string; + getUsersRealName: Function; + botUserId?: string; + isFirstMessage?: boolean; +}; + +/** + * Replaces '@Mentions' and '<@mentions>' from strings with the user's real name fetched from Slack + * Replaces channel links in the form of <#C0000ABC123|test-channel> with channel names, i.e. #test-channel + * ex: + * input I, <@U0000000123>, am gonna have a chat with <@U0000000456> over in <#C000000ABC|command-slack-bot> + * output: I, John Doe, am gonna have a chat with Richard Roe over in #command-slack-bot + */ +export const getSanitizedMessage = async ({ + message, + getUsersRealName, + botUserId, + isFirstMessage = false, +}: GetSanitizedMessageArgs) => { + const userIDAndNames: { [key: string]: string } = {}; + + // Match the format <@U0000000123> + const usersMentionedInMsg = message.match(/<@(.*?)>/g) || []; + + // Construct the userID and real name object + if (usersMentionedInMsg.length > 0) + for (let user of usersMentionedInMsg) { + // extract the user id from the string + const userId = (user.match(/\w+/g) ?? [''])[0]; + if (userId && !userIDAndNames[userId]) { + const usersRealName = await getUsersRealName({ userId }); + userIDAndNames[userId] = usersRealName ?? ''; + } + } + + let msgWithMemberNames = message; + if (Object.keys(usersMentionedInMsg).length > 0) + for (let [index, [key, value]] of Object.entries(userIDAndNames).entries()) { + // If this is the initial app_mention message, remove the first mention + if (isFirstMessage && index === 0 && key === botUserId) + msgWithMemberNames = msgWithMemberNames.replace(`<@${key}> `, ''); + + // After handling the first mention, replace all mentions with the user's real name + msgWithMemberNames = msgWithMemberNames.replaceAll(`<@${key}>`, value); + } + + // Match the format <#C0000ABC123|test-channel> and replace with #test-channel + const msgWithChannelNamesAndMemberNames = msgWithMemberNames.replace(/<#\w+\|([-\w]+)>/g, '#$1'); + + const msgWithSlackFormatting = slackify(msgWithChannelNamesAndMemberNames); + + return msgWithSlackFormatting; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getUsersRealName.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getUsersRealName.ts new file mode 100644 index 0000000000000000000000000000000000000000..00f0dbf7d02d728f6d60d744b941e9cadf857ed9 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/getUsersRealName.ts @@ -0,0 +1,13 @@ +import { AllMiddlewareArgs } from '@slack/bolt'; + +/** + * Given a slack user id, and bolt client, get the user's real name. + */ +export type GetUsersRealNameArgs = Pick & { + userId: string; +}; + +export const getUsersRealName = async ({ client, userId }: GetUsersRealNameArgs) => { + const userInfo = await client.users.info({ user: userId }); + return userInfo.user?.real_name ?? ''; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/messageHistory.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/messageHistory.ts new file mode 100644 index 0000000000000000000000000000000000000000..a5dddf88e2f215bd6f9ea94d110e187830d53729 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/messageHistory.ts @@ -0,0 +1,34 @@ +import { KnownEventFromType } from '@slack/bolt'; +import { WebClient } from '@slack/web-api'; + +import { handleError } from '../handlers'; +import { SlackMessages } from './actions'; + +/** + * Conversation Replies Method - https://api.slack.com/methods/conversations.replies + * Retrieve all thread replies using slack api + */ +export const extractMessageHistory = async ( + client: WebClient, + event: KnownEventFromType<'message'>, +) => { + let messages: SlackMessages = []; + if ('thread_ts' in event && event.thread_ts) { + try { + const conversations = await client.conversations.replies({ + channel: event.channel, + ts: event.thread_ts, + }); + messages = conversations.messages || []; + } catch (error) { + await handleError({ + error, + client, + userId: event.user, + replyChannelId: event.channel, + replyThreadTs: event.thread_ts, + }); + } + } + return messages; +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/slackAuth.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/slackAuth.ts new file mode 100644 index 0000000000000000000000000000000000000000..a4ebafabfc1413052559706b2a1c7180f528e5b7 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/utils/slackAuth.ts @@ -0,0 +1,36 @@ +import { prisma } from '..'; + +const getSlackAuthToken = async (enterpriseId?: string, teamId?: string) => { + if (!prisma || (!enterpriseId && !teamId)) return process.env.SLACK_BOT_TOKEN; + + const oauth = await prisma.oAuthInstallation.findUnique({ + where: { + teamId: teamId, + enterpriseId: enterpriseId, + }, + }); + if (!oauth) return process.env.SLACK_BOT_TOKEN; + + // @ts-ignore - Prisma JSONObject doesn't play well with TS + return oauth.installation.bot.token || process.env.SLACK_BOT_TOKEN; +}; + +export const getSlackFile = async ( + fileUrl: string, + enterpriseId?: string, + teamId?: string, +): Promise => { + const authToken = await getSlackAuthToken(enterpriseId, teamId); + + return await fetch(fileUrl, { + headers: { + Authorization: `Bearer ${authToken}`, + }, + }).then((response) => { + if (response.status !== 200) { + throw new Error('unable to access file through slack'); + } + // TODO: verify that the response is actually a file + return response.arrayBuffer(); + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/views/apiView.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/views/apiView.ts new file mode 100644 index 0000000000000000000000000000000000000000..0e2d524ec5b4d52d8174ba2be0013a32a2861e7b --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/views/apiView.ts @@ -0,0 +1,57 @@ +import { Middleware, SlackViewMiddlewareArgs } from '@slack/bolt'; + +import { prisma } from '..'; + +/** + * API View + * + * This view is called when the user submits the form on the setupCommand modal. It handles saving + * workspace settings to the db. + */ +export const apiView: Middleware = async ({ ack, context }) => { + await ack({ + response_action: 'update', + view: { + callback_id: 'api_view_success', + title: { + type: 'plain_text', + text: 'Command Setup', + emoji: true, + }, + type: 'modal', + close: { + type: 'plain_text', + text: 'Close', + emoji: true, + }, + blocks: [ + { + type: 'section', + block_id: 'intro_block', + text: { + type: 'mrkdwn', + text: "You're all set! 🎉", + }, + }, + { + type: 'section', + block_id: 'description_block', + text: { + type: 'mrkdwn', + text: 'Start a conversation with Command using *@Command*! To see what else Command offers, run the `/command-help` command!', + }, + }, + ], + }, + }); + + // Save Slack workspace settings to DB. + await prisma.workspaceSettings.upsert({ + create: { + teamId: context.teamId, + enterpriseId: context.enterpriseId, + }, + update: {}, + where: { teamId: context.teamId, enterpriseId: context.enterpriseId }, + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/views/index.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/views/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..df4ab7f6ca9212b1f4972cb94c2db41e6102a75f --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/views/index.ts @@ -0,0 +1,2 @@ +export * from './apiView'; +export * from './toolsView'; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/views/toolsView.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/views/toolsView.ts new file mode 100644 index 0000000000000000000000000000000000000000..9168b27d5726685e7ae097b29bf79ea3f2a7d4d9 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/src/views/toolsView.ts @@ -0,0 +1,82 @@ +import { Middleware, SlackViewMiddlewareArgs } from '@slack/bolt'; + +import { prisma } from '..'; + +// Extract the selected tools from the view and save them to the database +export const toolsView: Middleware = async ({ ack, view, context }) => { + const { channelId, hasPreEnabledTools, numOfGroups } = JSON.parse(view['private_metadata']); + + let selectedTools = []; + for (let i = 0; i < numOfGroups; i++) { + const selectedTool = + view['state']['values'][`tools_list_block_${i}`]['checkbox_action']['selected_options']; + if (selectedTool) { + selectedTools.push(...selectedTool); + } + } + + if (hasPreEnabledTools) { + const selectedPreEnabledTools = + view['state']['values']['enabled_tools_list_block']['checkbox_action']['selected_options']; + if (selectedPreEnabledTools) { + selectedTools.push(...selectedPreEnabledTools); + } + } + + if (!selectedTools) { + return; + } + const selectedToolNamesArray = selectedTools.map((tool) => tool.value); + const toolsMessage = + selectedToolNamesArray.length > 0 + ? `Tools enabled for this channel:\n • ${selectedToolNamesArray.join('\n • ')}` + : 'All tools have been disabled of this channel.'; + await ack({ + response_action: 'update', + view: { + callback_id: 'tools_view_success', + title: { + type: 'plain_text', + text: 'Tools Setup 🖇️', + emoji: true, + }, + type: 'modal', + close: { + type: 'plain_text', + text: 'Close', + emoji: true, + }, + blocks: [ + { + type: 'section', + block_id: 'description_block', + text: { + type: 'mrkdwn', + text: toolsMessage, + }, + }, + ], + }, + }); + + const workspaceSettings = await prisma.workspaceSettings.upsert({ + create: { teamId: context.teamId, enterpriseId: context.enterpriseId }, + update: {}, + where: { teamId: context.teamId, enterpriseId: context.enterpriseId }, + }); + + await prisma.channelSettings.upsert({ + create: { + channelId, + workspaceId: workspaceSettings.id, + tools: selectedToolNamesArray, + }, + update: { tools: selectedToolNamesArray }, + where: { + channelSettingsId: { + channelId, + workspaceId: workspaceSettings.id, + }, + }, + }); +}; diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/tsconfig.json b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..ac2c1ede726d81092771e939cf38c9f78ec642f4 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/tsconfig.json @@ -0,0 +1,21 @@ +{ + "include": ["**/*.ts"], + "exclude": ["node_modules"], + "compilerOptions": { + "allowJs": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "incremental": true, + "isolatedModules": false, + "lib": ["dom", "dom.iterable", "esnext"], + "module": "es2020", + "moduleResolution": "bundler", + "noEmit": true, + "outDir": "dist", + "resolveJsonModule": true, + "baseUrl": ".", + "skipLibCheck": false, + "strict": true, + "target": "ES2017" + } +} diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/tsup.config.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/tsup.config.ts new file mode 100644 index 0000000000000000000000000000000000000000..7a9309dd159318e69480a7fec33af5950b4e0d11 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/tsup.config.ts @@ -0,0 +1,5 @@ +import { defineConfig } from 'tsup'; + +export default defineConfig({ + format: ['cjs'], +}); diff --git a/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/vitest.config.ts b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/vitest.config.ts new file mode 100644 index 0000000000000000000000000000000000000000..d471e29f8eed7b6964c0bfe39ac96180ef01e321 --- /dev/null +++ b/western_ai/canada/cohere-toolkit/src/interfaces/slack_bot/vitest.config.ts @@ -0,0 +1,15 @@ +import tsconfigPaths from 'vite-tsconfig-paths'; +import { defineConfig } from 'vitest/config'; + +// Configure Vitest; https://vitest.dev/config/ +export default defineConfig({ + plugins: [tsconfigPaths()], + test: { + environment: 'node', + coverage: { + all: true, + include: ['src'], + reporter: ['html', 'json', 'json-summary', 'text', 'text-summary'], + }, + }, +}); diff --git a/western_ai/canada/nemo/.claude/settings.json b/western_ai/canada/nemo/.claude/settings.json new file mode 100644 index 0000000000000000000000000000000000000000..5442411386571c1b8d7f9c7cc23622a0790e593d --- /dev/null +++ b/western_ai/canada/nemo/.claude/settings.json @@ -0,0 +1,16 @@ +{ + "hooks": { + "PostToolUse": [ + { + "matcher": "Write|Edit", + "hooks": [ + { + "type": "command", + "command": "jq -r '.tool_input.file_path' | { read -r f; f=\"${f#\"$(git rev-parse --show-toplevel)/\"}\"; case \"$f\" in *.py) ;; *) exit 0;; esac; case \"$f\" in docs/*|external/*|examples/*) exit 0;; nemo/collections/speechlm2/*) ;; nemo/collections/*) exit 0;; esac; black --quiet \"$f\"; isort --quiet \"$f\"; } 2>/dev/null || true", + "timeout": 30 + } + ] + } + ] + } +} diff --git a/western_ai/canada/nemo/.claude/skills/babysit-pr/SKILL.md b/western_ai/canada/nemo/.claude/skills/babysit-pr/SKILL.md new file mode 100644 index 0000000000000000000000000000000000000000..244c114372818600373f34039c721fdc80b8fc0b --- /dev/null +++ b/western_ai/canada/nemo/.claude/skills/babysit-pr/SKILL.md @@ -0,0 +1,103 @@ +--- +name: babysit-pr +description: Get a pull request to green CI. Diagnose and fix CI failures, push fixes, re-trigger CI via the "Run CICD" label, and repeat until all checks pass. Does not post comments — this is a local developer tool. +--- + +# babysit-pr + +Get a PR's CI to green. Nothing else — no review comments, no PR comments, no status summaries. This skill is run locally by developers in their own sandboxes. + +## Inputs + +The PR number is the primary input. It may come from: +- An explicit argument: `/babysit-pr 567` +- The conversation context: "check on PR #567" +- A GitHub PR URL pasted into the chat + +If no PR number is clear, ask for it before proceeding. + +## Workflow + +### Step 1 — Get the full picture + +```bash +gh pr view --repo NVIDIA-NeMo/NeMo +gh pr checks --repo NVIDIA-NeMo/NeMo +gh pr diff --repo NVIDIA-NeMo/NeMo +``` + +Determine the current state: + +| State | What to do | +|------------------------------|--------------------------------------| +| CI failing | Diagnose and fix (Step 2) | +| Merge conflicts | Resolve (Step 3) | +| Formatting check failing | Wait — do NOT fix (see below) | +| CI green | Done, nothing to do | +| CI pending | Wait for it to finish, then reassess | + +### Checks to ignore + +The **"Isort and Black Formatting"** workflow (`reformat_with_isort_and_black` job) auto-pushes formatting fixes. If that check is failing or pending: +- Do NOT fix formatting yourself — the auto-formatter will push a commit shortly. +- Wait for it to complete and for the new commit to land before assessing other failures, since the formatting push changes the HEAD SHA and may re-trigger CI. + +### Step 2 — Fix CI failures + +Check out the PR branch and inspect the failure logs: + +```bash +gh pr checkout --repo NVIDIA-NeMo/NeMo +gh run list --repo NVIDIA-NeMo/NeMo --branch +gh run view --repo NVIDIA-NeMo/NeMo --log-failed +``` + +Before attempting a fix, check `git log` for recent commits. If you see a previous fix attempt that addressed the same failure and it is still failing, **stop and tell the user** — the issue needs human attention. Do not keep retrying the same fix. + +Otherwise, identify the root cause, fix the code, and push: + +```bash +git add +git commit -s -m "" +git push +``` + +### Step 3 — Re-trigger CI + +After pushing a fix, add the "Run CICD" label to re-trigger the CI pipeline: + +```bash +gh pr edit --repo NVIDIA-NeMo/NeMo --add-label "Run CICD" +``` + +The "CICD NeMo" workflow is triggered by this label and removes it automatically when done. + +Then wait for CI to complete and reassess. Go back to Step 1. + +### Step 4 — Resolve merge conflicts + +If the PR branch has fallen behind main and has conflicts: + +```bash +git fetch origin main +git rebase origin/main +# Resolve conflicts — keep the PR's intent, adopt refactors from main +git add +git rebase --continue +git push --force-with-lease +``` + +After rebasing, go back to Step 3 to re-trigger CI. + +## Rules + +- **Do NOT post comments on the PR.** This is a local tool — communicate with the user directly. +- **Do NOT address review comments.** The goal is green CI, not review resolution. +- **Do NOT fix formatting.** The `Isort and Black Formatting` action handles that automatically. +- **Do NOT retry a failed fix.** If your previous commit didn't resolve the failure, tell the user. +- **Do NOT create new PRs.** Push to the existing branch only. +- **Do NOT attempt to merge the PR or push to main.** + +## What done looks like + +CI is green (or the only remaining failures are pre-existing / flaky and you've told the user about them). That's it. diff --git a/western_ai/canada/nemo/.claude/skills/debug-training-logs/SKILL.md b/western_ai/canada/nemo/.claude/skills/debug-training-logs/SKILL.md new file mode 100644 index 0000000000000000000000000000000000000000..f425fdc6b4851f4c39389ac77ead7c8ca76fe757 --- /dev/null +++ b/western_ai/canada/nemo/.claude/skills/debug-training-logs/SKILL.md @@ -0,0 +1,320 @@ +--- +name: debug-training-logs +description: Debug distributed training failures (NeMo, Megatron, PyTorch) from worker stderr logs and optional AIStore daemon logs. Finds root cause across NCCL timeouts, data loading errors, and storage failures. +disable-model-invocation: true +allowed-tools: Bash Read Grep Glob Agent +argument-hint: [ais-logs-dir] +--- + +# Distributed Training Log Debugger + +You are debugging a distributed training job failure. The user will provide one or two directories: +- **Worker logs** (stderr from SLURM/torchrun): `$ARGUMENTS[0]` (required) +- **AIStore daemon logs** (proxy/target tarballs or extracted dirs): `$ARGUMENTS[1]` (optional) + +Your goal: find the **root cause**, not just the symptom. There are often cascading failures — one root cause triggers many downstream errors. Trace backwards from the final crash to the original trigger. + +## CRITICAL: Verification discipline + +**You MUST double-check every conclusion before presenting it to the user.** Distributed training failures have cascading effects that make it easy to mistake a symptom for the root cause. Follow these rules: + +1. **Check ALL ranks, not a sample.** Do not look at 5 ranks and assume the other 123 are the same. Use `sort -u` on the full output to find outliers. A single outlier rank can be the entire root cause. +2. **Verify NCCL state for EVERY rank.** Extract `last enqueued work` and `last completed work` for all ranks and check for ANY rank that differs. A rank with `enqueued == completed` (no pending ops) is fundamentally different from ranks with `enqueued > completed` (ops pending) — it means that rank never entered the stuck collective. +3. **Distinguish "First PG on this rank to signal dumping" from "Observed flight recorder dump signal from another rank".** The first is the initiator (its own watchdog fired). The second was notified (it may not even be in the collective). These are DIFFERENT failure modes. +4. **Before stating a root cause, re-verify it against the raw data.** Re-read the actual log lines. Do not rely on earlier summaries you wrote — they may have been wrong. +5. **If your analysis changes during the investigation, explicitly state what was wrong before and why.** Do not silently shift conclusions. + +## Phase 0: Obtain logs + +If the user has not provided worker logs, ask them to download and provide the SLURM error logs. The logs are typically on the compute nodes or in a shared filesystem. Suggest: + +```bash +# From the user's machine, SCP the SLURM error logs: +scp :/path/to/slurm/logs/error--*.out ./training_logs/ + +# Or if the logs are on a shared filesystem accessible from a login node: +mkdir -p ./training_logs +cp /path/to/slurm/error--*.out ./training_logs/ +``` + +The user needs to provide ALL per-node error files (e.g., `error-JOBID-0.out` through `error-JOBID-N.out`) — not just one node. Without all files you cannot identify which specific rank caused the failure. + +## Phase 1: Triage worker logs + +### 1.1 Understand the job +Read the first 80 lines of a few log files to determine: +- Framework (NeMo, Megatron, PyTorch Lightning, DeepSpeed, etc.) +- Scale (GPU count, node count, ranks per node) +- What the job is doing (training, fine-tuning, inference) +- Whether it resumed from a checkpoint + +### 1.2 Find the fatal errors +Search ALL log files in parallel for these patterns (priority order): + +**Tier 1 — Process killers:** +``` +NCCL.*timeout|Watchdog caught collective operation timeout +taking the entire process down +SIGTERM|SIGKILL|SIGABRT +CUDA error|CUDA out of memory|OOM +``` + +**Tier 2 — Training loop crashes:** +``` +RuntimeError|Exception.*Error +AISBatchLoaderError|StopIteration +Traceback \(most recent call last\) +``` + +**Tier 3 — Data loading / IO:** +``` +Connection reset|Connection broken|Connection refused +retrying [0-9]+/[0-9]+ +timed out|deadline exceeded +broken pipe +``` + +### 1.3 Identify the initiator and the straggler +For NCCL timeouts, you MUST check ALL ranks — do not sample. Extract the full NCCL state for every rank: + +```bash +# Get watchdog state for all ranks that fired their own watchdog: +grep "failure detected by watchdog" error-*.out | grep -o "Rank [0-9]*.*last enqueued work: [0-9]*, last completed work: [0-9]*" | sort -u + +# Get ranks that were NOTIFIED (did not fire their own watchdog): +grep "Observed flight recorder dump signal from another rank" error-*.out | grep -o "Rank [0-9]*" + +# Count total unique ranks found vs expected: +grep "failure detected by watchdog" error-*.out | grep -o "Rank [0-9]*" | sort -t' ' -k2 -n -u | wc -l +``` + +**The rank that "Observed" instead of "detected" is likely the straggler** — it had no pending NCCL operations because it never entered the collective. Check its `Last enqueued NCCL work` — if it equals `last completed NCCL work`, the rank was stuck OUTSIDE NCCL (in the training loop, data loading, etc.), not inside a collective. + +For NCCL BROADCAST/ALLREDUCE timeouts, calculate when the collective started: +`start_time = timeout_time - timeout_ms` (usually 1800000ms = 30min) + +### 1.4 Count and classify +- Count `Connection reset` across all files (total and per-file) +- Check retry patterns: are retries always 1/N (recovering) or do they escalate to N/N (exhausted)? +- Count unique error types and affected ranks +- Look for `AISBatchLoaderError` or similar batch loader errors — these indicate AIStore returned fewer objects than requested + +### 1.5 Build the timeline +Determine the **causal chain**: which error happened first, which are consequences. +The pattern is usually: +``` +Data loading error (root cause) + -> Some ranks crash out of training loop + -> Crashed ranks can't participate in NCCL collective + -> NCCL collective hangs for timeout period (usually 30min) + -> Watchdog kills all remaining ranks +``` + +### 1.6 Check NeMo-specific synchronization points + +NeMo has per-step collective operations that can cause rank desynchronization: + +- **PreemptionCallback** (`nemo/utils/callbacks/preemption.py`): Calls `torch.distributed.broadcast(interrupted, 0)` at the end of EVERY training step via `on_train_batch_end`. If one rank's training step takes >30 min longer than others, this broadcast times out. +- **NeMoModelCheckpoint** (`nemo/utils/callbacks/nemo_model_checkpoint.py`): Multiple `trainer.strategy.broadcast()` calls during checkpoint save/load. +- **DDP gradient all-reduce**: Automatic per-step synchronization during backward pass. +- **`broadcast_buffers`** (DDP default=True): Broadcasts model buffers (e.g., batch norm stats) from rank 0 at each forward pass. + +If rank 0 is ahead of other ranks in NCCL SeqNum, check whether the gap matches the number of per-step collectives (PreemptionCallback broadcast + DDP allreduce + broadcast_buffers = ~3 ops per step). + +## Phase 1.7: Request AIStore logs if not provided + +If the analysis points to storage I/O issues (connection resets, data loading errors, timeouts) and the user did NOT provide AIS daemon logs, suggest downloading them. First check if the `ais` CLI is available (`which ais`). If it is, guide the user through: + +1. **Set the cluster endpoint** (ask the user for the endpoint URL): + ```bash + export AIS_ENDPOINT=https://: + ``` + +2. **Set the auth token** (ask the user for the token value): + ```bash + export AIS_AUTHN_TOKEN= + ``` + +3. **Handle TLS** — skip cert verification or point to the CA cert: + ```bash + # Option A: skip verification + ais config cli set cluster.skip_verify_crt=true + # Option B: set CA cert + export AIS_SERVER_CRT=/path/to/ca.crt + ``` + +4. **Download all cluster logs** to the current log directory: + ```bash + ais log get cluster /ais_logs + ``` + This downloads TAR.GZ archives from all proxy and target nodes. + +5. Extract and analyze per Phase 2 below. + +If the `ais` CLI is not installed, it can be built from the AIStore repository (`cd cmd/cli && go install .`) or downloaded as a binary. Alternatively, ask the user to download the logs manually from the AIS cluster. + +## Phase 2: Debug AIStore logs (if provided) + +### 2.1 Extract and orient +If tarballs (`.tar.gz`), extract them: +```bash +mkdir -p extracted && cd extracted +for f in ../*.tar.gz; do + name=$(basename "$f" .tar.gz) + mkdir -p "$name" && tar xzf "$f" -C "$name" +done +``` + +**AIS log file naming and time ranges:** + +AIS daemon logs follow the naming convention: +``` +aistarget.ais-target-N.INFO.MMDD-HHMMSS.1 # target logs +aisproxy.ais-proxy-N.INFO.MMDD-HHMMSS.1 # proxy logs +``` + +A single daemon (target or proxy) may have **multiple log files** — each file covers a specific time range: +- The `MMDD-HHMMSS` in the filename is the **start time** of that file +- The file covers from its start time **until the start time of the next file** for the same daemon +- If there is no next file, it covers until the daemon stopped or the logs were collected +- A new file is created when the daemon restarts (crash, upgrade, maintenance cycle) + +**To find the correct file for a failure window:** +1. List all files for each daemon, sorted by the timestamp in the filename +2. For each daemon, find the file whose start time is BEFORE the failure window AND whose next file's start time is AFTER the failure window (or there is no next file) +3. A daemon may have been restarted DURING the failure window — check if any file starts within the window (this indicates a restart, which is itself significant) +4. Log lines within a file only have TIME (HH:MM:SS), not dates. If a file spans midnight, the same time (e.g., "21:30") may appear twice — once for each day. Use surrounding context (stats counter values, known events) to disambiguate which day a log line belongs to. + +**Always check ALL files for a daemon, not just the latest.** The latest file may only cover minutes after a restart, while the failure evidence is in an earlier file. + +**Timezone verification:** +AIS daemon logs and worker (SLURM/torchrun) logs may be on different machines in different timezones. NEVER assume they match. To verify: +1. Look for AIS periodic timestamp markers: `common:NNN DD Mon YY HH:MM UTC =============` — these explicitly state the timezone (typically UTC). +2. Look for absolute timestamps in worker logs: NeMo uses `YYYY-MM-DD HH:MM:SS`, SLURM uses `YYYY-MM-DDThh:mm:ss` — but neither includes timezone by default. +3. **Cross-reference a known event** visible in both log sources. The best anchor is the job death: find the SLURM `CANCELLED` timestamp in worker logs, then find the exact moment `get.n` stops incrementing in AIS stats. If they align, the timezones match. If they're offset by a round number of hours, one system is in a different timezone. +4. If timezones don't match, apply the offset consistently before correlating events. + +### 2.2 Check target stats during failure window +AIStore targets emit periodic stats lines (every ~3 min). Extract key counters around the failure time: + +**Critical counters to track:** +- `err.get.n` — GET errors (should be stable; spikes indicate problems) +- `err.getbatch.n` — batch GET errors +- `err.http.write.n` — broken HTTP responses to clients +- `err.put.n`, `err.head.n`, `err.lst.n` — other operation errors +- `get.n` vs `err.get.n` — compute error rate +- `getbatch.n`, `getbatch.obj.n` — batch operation counts + +Compare values between consecutive stats lines to find the **delta** (new errors in that interval). + +### 2.3 Search for error-level messages +``` +grep "^E " # Error messages +grep "^W " # Warning messages +``` + +**Key error patterns in AIStore:** +- `x-get-batch.*out-of-bounds index` — batch GET lost objects during inter-target streaming +- `shared-dm.*terminated.*broken pipe` — inter-target data mover stream failure +- `shared-dm: xid.*not found, dropping recv` — objects dropped because batch job already aborted +- `resource pressure: load=critical` — target under disk/memory/CPU pressure +- `lcache.*hk.*dsk=critical` — disk at critical level, housekeeping skipped +- `gc:.*free mem` / `oom:` — memory pressure / forced GC + +### 2.4 Check proxy logs +The proxy orchestrates batch GETs. Check proxy stats for: +- `err.get.n` — should be near zero; high = proxy-level routing failures +- `err.http.write.n` — proxy dropping client connections + +If proxy errors are stable but target errors are spiking, the problem is target-side (disk, memory, inter-target networking). + +### 2.5 Correlate the `x-get-batch` failure mechanism +The typical AIStore batch GET failure chain: +``` +1. Target under resource pressure (dsk=critical, mem=low) +2. Inter-target shared-dm streams break (broken pipe) +3. x-get-batch gets out-of-bounds index (recv'd len=0) +4. Batch job aborted, subsequent objects dropped (xid not found) +5. Client receives fewer objects than requested +6. Lhotse/client batch loader raises error (iterator exhausted prematurely) +``` + +## Phase 3: Synthesize + +### 3.1 Write the report +Structure your output as: + +**Job Details** — framework, scale, start time, data source + +**Timeline Table** — chronological events with timestamps, source file:line + +**Root Cause Chain** — numbered chain from trigger to final crash, with arrows + +**Key Files** — which log files contain the critical evidence + +**Recommendations** — actionable fixes (storage-side, client-side, training config) + +### 3.2 Classify the failure +Common root cause categories: +- **Storage I/O**: disk pressure, broken pipes, connection resets, batch object loss +- **Network**: NCCL timeout without data errors, NIC failures, switch issues +- **GPU/CUDA**: OOM, ECC errors, CUDA assertions +- **Data**: corrupt/missing data files, manifest mismatches, schema errors +- **Software**: version mismatches, config errors, OOM in Python process +- **Infrastructure**: node failure, preemption, SLURM timeout +- **Data loading stall**: single rank stuck in data loading (no timeout on read), blocking all other ranks at the next collective + +## Reference: AIStore error counter meanings + +| Counter | Meaning | +|---|---| +| `err.get.n` | Individual object GET failures on this target | +| `err.getbatch.n` | Batch GET operation failures | +| `err.http.write.n` | Failed HTTP writes to client (connection dropped) | +| `err.append.n` | Append operation failures | +| `err.put.n` | PUT operation failures | +| `err.head.n` | HEAD (metadata) operation failures | +| `err.lst.n` | List operation failures | +| `err.kalive.n` | Keep-alive failures | +| `getbatch.n` | Total batch GET operations | +| `getbatch.obj.n` | Total objects served via batch GET | +| `getbatch.throttle.ns` | Time spent throttling batch GETs | + +## Reference: NCCL timeout anatomy + +- `Watchdog caught collective operation timeout` — the NCCL watchdog detected a stuck collective +- `SeqNum=N, OpType=BROADCAST/ALLREDUCE` — which collective and sequence number +- `last enqueued work: N, last completed work: M` — work M completed, work M+1 is stuck +- `Timeout(ms)=1800000` — 30-minute timeout (default) +- `First PG on this rank to signal dumping` — THIS rank initiated the cascade +- `Observed flight recorder dump signal from another rank` — this rank is reacting to another's timeout +- `To avoid data inconsistency, we are taking the entire process down` — watchdog kills the process + +### Distinguishing data loading stalls from GPU/NCCL hangs + +The `last enqueued work` vs `last completed work` state is critical for determining whether the hang is in the CPU (data loading, training loop) or in the GPU (NCCL communication): + +- **If `enqueued == completed` (no pending ops)**: This rank has NO NCCL work in-flight. It is stuck in the CPU-side training loop (data loading, audio decoding, batch prep) and never entered the collective. **This is the straggler — the rank that caused the hang.** +- **If `enqueued == completed + 1`**: The rank has submitted exactly one operation that hasn't completed. It entered the collective but can't complete because the straggler rank hasn't joined. +- **If `enqueued > completed + 1`**: Multiple operations are queued — the CPU has progressed past the stuck point and submitted additional operations asynchronously (e.g., DDP gradient allreduce via hooks). Still waiting for the straggler. +- **If rank 0 has higher `enqueued`/`completed` than others**: Rank 0 (often the broadcast root) completed its side of a collective (send) but receivers can't complete (receive) because the straggler hasn't joined. + +**The key pattern for a data loading stall:** +- 1 rank: `enqueued == completed`, `active collectives: 0`, "Observed flight recorder dump signal from another rank" — **this is the straggler** +- N-1 ranks: `enqueued > completed`, "failure detected by watchdog" — these are waiting for the straggler +- Rank 0: may be further ahead if it's the broadcast root (can complete send without receivers) + +**The key pattern for a GPU fabric issue:** +- ALL ranks: `enqueued > completed` (all entered the collective), all show "First PG on this rank to signal dumping" — no straggler, the collective itself is broken + +Compare `enqueued` counts across ALL ranks. Even ONE outlier changes the entire diagnosis. + +## Reference: NeMo/Lhotse data loading pitfalls + +Common data loading issues that cause single-rank stalls: + +- **No timeout on Lhotse URL audio reads**: `AudioSource._prepare_for_reading()` calls `f.read()` with no Lhotse-level timeout. A stalled download blocks the DataLoader worker indefinitely. +- **`fault_tolerant=True` silently drops failed audio**: Failed audio files are skipped, reducing effective batch size per rank. Different ranks may have different failure rates depending on their shard assignments. +- **`.m4a` files lose extension in BytesIO**: When audio is downloaded from URLs and wrapped in BytesIO, the file extension is lost. Lhotse's `CompositeAudioBackend` cannot use the fast-path for m4a (TorchaudioFFMPEGBackend) and falls through to expensive cascading backend trials. +- **Connection reset on idle keep-alive**: AIStore closes idle HTTP connections after 30s (`DfltMaxIdleTimeout`). The Python SDK's urllib3 pool doesn't match this timeout, causing `Connection reset by peer` on stale pooled connections. These are caught and retried (always succeed on 1st retry) — they are noise, NOT a root cause. +- **Each rank gets disjoint data shards**: Lhotse splits shards via `src[rank::world_size]`. One rank may get shards with more corrupt files, larger audio, or slower storage targets. diff --git a/western_ai/canada/nemo/.claude/skills/fix-issue/SKILL.md b/western_ai/canada/nemo/.claude/skills/fix-issue/SKILL.md new file mode 100644 index 0000000000000000000000000000000000000000..3b47289058c4101830d35f702dbdc242441a6a27 --- /dev/null +++ b/western_ai/canada/nemo/.claude/skills/fix-issue/SKILL.md @@ -0,0 +1,79 @@ +--- +name: fix-issue +description: Fix a GitHub issue in NeMo Speech (NVIDIA-NeMo/NeMo). Read the issue, reproduce the bug with a failing test, implement the fix, and verify tests pass. Only opens a PR if the user explicitly asks for it. +--- + +# fix-issue + +Fix a GitHub issue in NeMo Speech from first principles: understand the bug, prove it with a test, and fix the root cause. + +The key discipline is **reproduce first, fix second**. Writing the failing test before touching the source code forces a precise understanding of what broken actually means, which keeps the fix focused and correct. + +## Inputs + +The issue number is the primary input. It may come from: +- An explicit argument: `/fix-issue 1234` +- The conversation context: "fix issue #1234" +- A GitHub issue URL pasted into the chat + +If no issue number is clear, and the description provided is not good enough, ask for more details before proceeding. + +## Before starting + +Read the issue description carefully. Identify: +- What is the reported failure (error message, wrong output, crash)? +- Which collections in `nemo/collections` and components are affected? +- Are there any repro steps already in the issue? If so, run them first. +- Is there a linked PR or related issue that gives more context? + +## Workflow + +1. Read the issue: `gh issue view --repo NVIDIA-NeMo/NeMo` +2. Understand the bug — identify the relevant code +3. Write a minimal reproduction test in `tests/` that demonstrates the failure +4. Run the test to confirm it fails: `pytest -v` +5. Implement the fix in the source code +6. Run the test again to confirm it now passes +7. Run the broader test suite for the affected collection to check for regressions: + ```bash + pytest tests/collections// -m "not pleasefixme" -v --timeout=120 + ``` +8. Tell the user the fix is ready and what was changed + +## Opening a PR + +Only create a branch and open a PR if the user explicitly asks for it. When they do: + +```bash +git checkout -b fix/- +git add +git commit -s -m "Fix (closes #)" +git push origin fix/- +gh pr create --repo NVIDIA-NeMo/NeMo \ + --title "Fix " \ + --body "$(cat <<'EOF' +# What does this PR do ? + + +# Changelog + + +# Usage + + +Fixes # +EOF +)" +``` + +Notes: +- Add specific files by name — do not use `git add -A` or `git add .`. + +## Rules + +- **Reproduce first.** Do not attempt a fix without a failing test that demonstrates the bug. +- **Do NOT open a PR unless the user asks.** The default is local-only: fix the code, verify it works, report back. +- **Do NOT post comments on the GitHub issue.** Communicate with the user directly. +- **Do NOT reformat files outside your changes.** The `Isort and Black Formatting` action handles formatting automatically. +- **Never push to `main` directly.** +- **Never attempt to merge the PR yourself.** diff --git a/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/SKILL.md b/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/SKILL.md new file mode 100644 index 0000000000000000000000000000000000000000..360369467945aaa910f61728f25dfa565217b61e --- /dev/null +++ b/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/SKILL.md @@ -0,0 +1,78 @@ +--- +name: nemo-speech-asr-finetune +description: Guide NeMo Speech users through ASR fine-tuning with container setup and Lhotse training. +--- + +# NeMo Speech ASR Fine-Tuning + +Use this skill when a user wants to fine-tune a NeMo Speech ASR model, choose a checkpoint, adapt a tokenizer, +configure Lhotse dataloading, train, average checkpoints, or evaluate a fine-tuned ASR `.nemo` checkpoint. +Also use it for post-run refinement planning after fine-tuning. + +Default posture: + +- Use the NeMo container unless the user explicitly asks for local execution. +- Prefer Lhotse for train and validation dataloaders. +- Use `trainer.max_steps`, not `trainer.max_epochs`. +- Use `val_wer` as the checkpoint monitor for validation. +- By default, evaluate WER without capitalization and punctuation effects. Change that only when the user explicitly + asks for raw/cased/punctuated scoring. +- Report final quality from standalone evaluation, not only in-training validation logs. + +## Staged Workflow + +Load only the reference file needed for the current stage: + +1. Setup and checkpoint selection: read `references/setup-checkpoints.md`. +2. Data prep, transcript-style preflight, Lhotse, bucketing, validation dataloader, and blends: read + `references/data-lhotse.md`. +3. Architecture detection, tokenizer changes, and AED/Canary multitask metrics: read + `references/architecture-tokenizer-metrics.md`. +4. Training, checkpoint averaging, and evaluation: read `references/training-evaluation.md` and, when reporting WER, + `references/evaluation-style-contract.md`. +5. Post-run refinement, error analysis, curriculum, and general-vs-domain evaluation: read + `references/refinement-iteration.md`. + +If the user explicitly asks for parallel/sub-agent work, split the work by these same stages. Keep each agent scoped to +one stage and have the main agent integrate the final command/config. + +## Core Commands + +Generic fine-tuning uses `examples/asr/speech_to_text_finetune.py`. For architecture-specific recipes, route to: + +- CTC: `examples/asr/asr_ctc/speech_to_text_ctc_bpe.py` +- RNNT: `examples/asr/asr_transducer/speech_to_text_rnnt_bpe.py` +- Hybrid RNNT/CTC or TDT/CTC: `examples/asr/asr_hybrid_transducer_ctc/speech_to_text_hybrid_rnnt_ctc_bpe.py` +- AED/Canary: `examples/asr/speech_multitask/speech_to_text_aed.py` + +Always check the current repo docs before giving version-sensitive claims: + +- `README.md` +- `docs/source/asr/fine_tuning.rst` +- `docs/source/asr/datasets.rst` +- `docs/source/dataloaders.rst` +- `docs/source/asr/featured_models.rst` +- `docs/source/asr/asr_checkpoints.rst` +- `nemo/collections/common/data/lhotse/dataloader.py` + +## Non-Negotiable Pitfalls + +- When changing Lhotse batch modes, explicitly null conflicting options. For OOMptimizer profiles, set + `batch_size=null`, `batch_duration=null`, and `quadratic_duration=null` when adding `bucket_batch_size`. +- Set `model.validation_ds.use_lhotse=true`, but prefer static validation `batch_size` with bucketing disabled. +- Do not use fused loss/WER or tune `fused_batch_size` for RNNT/TDT fine-tuning guidance from this skill. +- Run the first OOMptimizer pass with default CLI settings; lower `--memory-fraction` only after a real training OOM. +- Run preflight checks before long jobs: disk space, free GPUs, manifest validity, and duration/text sanity. +- Before any fine-tuning, audit transcript style within and across all fine-tuning/validation/test sources. Do not + train on mixed casing, punctuation, inverse-text-normalization, or symbol conventions; choose and fix one target style + first, and compare it with the original checkpoint's prediction style when applicable. +- For small domain adaptation, start with a lower LR than large-data fine-tuning; do not blindly use `1e-4`. +- Do not train a tokenizer on validation or test transcripts. +- Do not ignore silent Lhotse filtering from `min_duration`, `max_duration`, `min_tps`, and `max_tps`. +- Do not use `amp=true` for inference/evaluation; use `amp=false compute_dtype=bfloat16`. +- Unless the user asks otherwise, report the default WER with capitalization and punctuation removed, and record any raw + WER separately when it helps diagnose transcript-style mismatch. +- For AED/Canary, configure `multitask_metrics_cfg` so ASR and translation/task-specific samples are evaluated with + the right constrained metrics. +- If checkpoint averaging is used, evaluate the averaged checkpoint and keep it only if it beats the best individual + checkpoint. diff --git a/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/assets/experiment-ledger-template.md b/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/assets/experiment-ledger-template.md new file mode 100644 index 0000000000000000000000000000000000000000..98209b680bf1bcb6675ce12541727d13396c9973 --- /dev/null +++ b/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/assets/experiment-ledger-template.md @@ -0,0 +1,92 @@ +# ASR Fine-Tuning Experiment Ledger + +## Goal + +- User goal: +- Target checkpoint: +- Architecture: +- Success metric: +- Optional guardrail metrics: + +## Data + +- Train manifests or input config: +- Validation manifest: +- Test manifest: +- Data sources and weights: +- Tarred/non-tarred: +- Manifest sharding: +- Transcript style policy: +- Style transform artifact: +- Original checkpoint output style: +- Style mismatch decision: + +## Preflight + +- Disk space: +- GPUs: +- Container/image: +- Manifest validation: +- Duration distribution: +- Text/token distribution: +- Duration/token filters: +- Examples/hours filtered: + +## Lhotse And OOMptimizer + +- Lhotse train: +- Lhotse validation: +- Bucketing mode: +- Duration bins: +- Bucket batch sizes: +- Static batch size: +- `bucket_buffer_size`: +- `shuffle_buffer_size`: +- `seed`: +- `shard_seed`: +- OOMptimizer settings: +- Training pilot utilization: +- CPU memory notes: + +## Training + +- Init checkpoint: +- Script/config: +- Precision: +- `sync_batchnorm`: +- `max_steps`: +- `limit_train_batches`: +- `val_check_interval`: +- LR: +- Scheduler: +- Warmup: +- Min LR: +- Save top K: +- Command/log path: + +## Evaluation + +| Model | Artifact | Prediction Manifest | Raw WER | Default WER | CER | Notes | +| --- | --- | --- | --- | --- | --- | --- | +| baseline | | | | | | | +| final `.nemo` | | | | | | | +| best single | | | | | | | +| averaged | | | | | | | + +Default WER uses capitalization and punctuation removal unless the user requested a different metric. + +## Error Analysis + +- Raw vs default WER gap: +- Worst sources/domains: +- Worst categories: +- Label/audio defects: +- Decoding findings: + +## Decision + +- Keep artifact: +- Drop artifacts: +- Next intervention: +- Reason: +- If validation/test influenced data or weights, blind holdout plan: diff --git a/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/references/architecture-tokenizer-metrics.md b/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/references/architecture-tokenizer-metrics.md new file mode 100644 index 0000000000000000000000000000000000000000..7904e60b871602cb35497d840a852855997c6a46 --- /dev/null +++ b/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/references/architecture-tokenizer-metrics.md @@ -0,0 +1,153 @@ +# Stage 3: Architecture, Tokenizer, And AED Metrics + +## Architecture Detection + +Inspect the model config before choosing scripts and overrides: + +```python +from nemo.collections.asr.models import ASRModel + +cfg = ASRModel.from_pretrained("nvidia/parakeet-tdt-0.6b-v3", return_config=True) +print(cfg.target) +print(cfg.get("decoder", None)) +print(cfg.get("joint", None)) +print(cfg.get("loss", None)) +print(cfg.get("decoding", None)) +``` + +Classify: + +- CTC: `EncDecCTC*`, `ConvASRDecoder`, no RNNT-style `joint`. +- RNNT: `EncDecRNNT*` with `decoder` and `joint`. +- TDT: RNNT-family config with `loss.loss_name: tdt`, `decoding.model_type: tdt`, durations, or extra duration + outputs. +- Hybrid RNNT/CTC or TDT/CTC: `EncDecHybridRNNTCTC*`, `aux_ctc`, `ctc_decoder`. +- AED/Canary: `EncDecMultiTaskModel`, Transformer decoder, `prompt_format`. + +Use `examples/asr/speech_to_text_finetune.py` for compatible-architecture fine-tuning. For architecture-specific +recipes: + +- CTC: `examples/asr/asr_ctc/speech_to_text_ctc_bpe.py` +- RNNT: `examples/asr/asr_transducer/speech_to_text_rnnt_bpe.py` +- Hybrid RNNT/CTC or TDT/CTC: `examples/asr/asr_hybrid_transducer_ctc/speech_to_text_hybrid_rnnt_ctc_bpe.py` +- AED/Canary: `examples/asr/speech_multitask/speech_to_text_aed.py` + +Reference configs to inspect before writing overrides: + +- CTC: `examples/asr/conf/fastconformer/fast-conformer_ctc_bpe.yaml` +- RNNT: `examples/asr/conf/fastconformer/fast-conformer_transducer_bpe.yaml` +- TDT: `examples/asr/conf/conformer/tdt/conformer_tdt_bpe.yaml` +- Hybrid TDT/CTC: `examples/asr/conf/fastconformer/hybrid_transducer_ctc/fastconformer_hybrid_tdt_ctc_bpe.yaml` +- AED/Canary: `examples/asr/conf/speech_multitask/fast-conformer_aed.yaml` + +## Tokenizer Decisions + +Keep the pretrained tokenizer when language/script, casing, punctuation, and symbols match. Replace or extend it when +the target language/script is new, important symbols are missing, normalization changes substantially, the run is +multilingual/code-switching, or Canary/AED prompt/special tokens change. + +Train from training text only: + +```bash +python scripts/tokenizers/process_asr_text_tokenizer.py \ + --manifest=/data/train.json \ + --data_root=/data/tokenizers/my_tokenizer \ + --vocab_size=1024 \ + --tokenizer=spe \ + --spe_type=unigram \ + --log +``` + +Replace in generic fine-tuning: + +```bash +model.tokenizer.update_tokenizer=true \ +model.tokenizer.dir=/data/tokenizers/my_tokenizer/tokenizer_spe_unigram_v1024 \ +model.tokenizer.type=bpe +``` + +Changing tokenizer size usually reinitializes decoder-side parameters such as CTC projection or RNNT/TDT +decoder/joint pieces. Use conservative LR and validate early. + +Aggregate tokenizer: + +```yaml +tokenizer: + type: agg + langs: + en: + dir: /data/tokenizers/en/tokenizer_spe_unigram_v1024 + type: bpe + es: + dir: /data/tokenizers/es/tokenizer_spe_unigram_v1024 + type: bpe +``` + +Standard aggregate ASR configs expect a manifest language field such as `lang`. AED/Canary configs use their own +prompt and language fields; follow `examples/asr/conf/speech_multitask/fast-conformer_aed.yaml`. + +## Architecture-Specific Knobs + +CTC: + +- Main tokenizer-sensitive module is the decoder projection. +- Useful when alignments or non-autoregressive decoding matter. +- Long transcripts can violate CTC length constraints; subword tokenization helps reduce target length. + +RNNT: + +- Disable fused loss/WER for this skill: `model.joint.fuse_loss_wer=false`. +- Do not tune `fused_batch_size`; use Lhotse bucketing plus OOMptimizer-generated `bucket_batch_size`. +- `model.compute_eval_loss=false` is common when validation samples are long and WER is the main metric. +- Use CUDA graphs for inference/evaluation when supported. + +TDT: + +- Preserve `loss.loss_name=tdt`, duration settings, extra outputs, and `decoding.model_type=tdt`. +- Disable fused loss/WER and use Lhotse bucketing plus OOMptimizer. +- Use CUDA graphs for inference/evaluation when supported. + +Hybrid: + +- Check `model.aux_ctc.ctc_loss_weight`; reference configs often use `0.3`. +- Evaluate both decoder paths when relevant with `decoder_type=ctc` and `decoder_type=rnnt`. + +AED/Canary: + +- Use `examples/asr/speech_multitask/speech_to_text_aed.py`. +- Preserve `prompt_format` and expected manifest fields. +- Prefer 2D Lhotse buckets plus OOMptimizer. + +## AED/Canary Multitask Metrics + +`EncDecMultiTaskModel` reads `model.multitask_metrics_cfg` and constructs `MultiTaskMetric` +(`nemo/collections/asr/metrics/multitask.py`). Metric constraints are evaluated against each Lhotse cut's `custom` +dict, including manifest fields and `input_cfg.tags`. + +Reference config: + +```yaml +model: + multitask_metrics_cfg: + log_predictions: true + metrics: + wer: + _target_: nemo.collections.asr.metrics.WER + constraint: ".source_lang==.target_lang" + bleu: + _target_: nemo.collections.asr.metrics.BLEU + constraint: ".source_lang!=.target_lang" + bleu_tokenizer: 13a + check_cuts_for_bleu_tokenizers: false +``` + +Use constraints to route ASR samples to WER and translation samples to BLEU. Add dataset/task/domain metadata through +manifest fields or `input_cfg.tags`, then reference it in constraints such as `.domain==target` or +`.task==asr and .source_lang==.target_lang`. + +Current implementation supports only one instance of each metric class in a single `multitask_metrics_cfg`. For +multiple WER slices by language/domain, prefer separate validation manifests/dataloaders or extend metric aggregation +rather than defining duplicate WER metrics. + +For AED validation data, set `use_lhotse: true`, `use_bucketing: false`, static `batch_size`, `text_field: "text"`, +and `lang_field: "target_lang"`. diff --git a/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/references/data-lhotse.md b/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/references/data-lhotse.md new file mode 100644 index 0000000000000000000000000000000000000000..71da5fb98a0cb0b01882a48088e2671740d30de9 --- /dev/null +++ b/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/references/data-lhotse.md @@ -0,0 +1,255 @@ +# Stage 2: Data, Lhotse, Bucketing, And Blends + +Use Lhotse by default for training and validation. For validation, prefer Lhotse with static `batch_size` and no +bucketing; dynamic validation batches can rarely starve DDP ranks. + +## Manifest Preparation + +Standard ASR JSONL: + +```json +{"audio_filepath": "/data/audio/sample.wav", "text": "transcript text", "duration": 3.42} +``` + +Use separate train, validation, and test manifests. Prefer 16 kHz mono audio unless the model card/config says +otherwise. + +## Transcript Style Preflight + +Do this before sharding, tokenizer changes, OOMptimizer, or fine-tuning. Treat mixed transcript style as an experiment +setup failure. + +For every train, validation, and test manifest, and for each source inside a blend, audit a representative sample of +reference transcripts. At minimum, report: + +- Fraction with uppercase letters. +- Fraction with punctuation or symbols, including sentence punctuation, quotes, dashes, and brackets. +- Number, abbreviation, currency, unit, and special-symbol conventions. +- Unicode normalization and script/language consistency. +- A few examples before and after the intended text transform. + +The target style must be consistent within and across all fine-tuning sources, and the validation/test style must match +the metric being optimized. Do not rely on blend weights to average away style conflicts. If one source is cased and +punctuated and another is lowercase/no-punctuation, fix the manifests or split the task before launching training. + +Also check the original checkpoint's prediction style when applicable: + +- First read the model card/config/docs for punctuation, capitalization, ITN, language, and prompt behavior. +- If the checkpoint can already transcribe the target language or a close proxy, run a small baseline transcription on + representative fine-tuning audio and compute the same style rates on predictions. +- If the checkpoint is being moved to a new language/script and baseline predictions are unreliable, do not infer style + from bad transcripts; record the checkpoint style as documented or unknown. + +If all fine-tuning data is internally consistent but differs from the original checkpoint's prediction style, that can +be acceptable. Flag it to the user because the model may shift output style and raw WER may move even when recognition +improves. In autonomous runs, consider adapting the fine-tuning transcripts to the checkpoint's output style when that +style is required by deployment or evaluation. If that requires adding missing punctuation/case/ITN labels, treat the +new labels as generated data: validate them and keep the raw manifests. + +Choose one target style and materialize new manifests before training: + +- Normalized ASR style: lowercase if appropriate for the language, remove punctuation/symbols that are not part of the + target transcript, normalize whitespace and Unicode, and score with the same normalization. +- Cased/punctuated/ITN style: use data that already has reliable labels in that style, or restore missing style labels + with a validated post-processing pipeline. Do not mix unstyled labels into this target style without relabeling. +- Prompted AED/Canary style: use task/language/punctuation prompts only when the selected script and metrics support + separating those behaviors; otherwise still enforce one transcript style per fine-tuning objective. + +Preserve raw manifests. Write derived manifests with a clear suffix such as `_style_normalized.json`, record the exact +transform, and include the style audit in the run ledger. + +Shard training manifests even when not tarred. For resume-heavy fine-tuning with an unsharded non-tarred manifest, +each restart can begin iterating from the start again. Split into shards like `manifest_0.json` ... `manifest_N.json` +with roughly 200 utterances per shard. This is less important for one-shot runs that will not be interrupted. + +Strongly prefer tarred data for slow filesystems and object stores. If data is small or there is abundant fast local +SSD, non-tarred audio is fine, but still shard the manifest. Do not use tarred datasets for validation/test unless the +target script and docs explicitly support the behavior you need. + +Before training, inspect duration and token-per-second distributions. Set `min_duration`, `max_duration`, `min_tps`, +and `max_tps` so they do not silently filter out a large or important part of the fine-tuning set. + +If OOMptimizer cannot fit batch size 1 for an extreme duration bucket, inspect the duration tail before changing the +model or precision. When only a tiny outlier fraction is affected, set `max_duration` to cap that tail, record the +number and hours filtered, and rerun OOMptimizer with the capped final bucket. Do not silently cap substantial or +domain-critical long-form data. + +When duration-tail capping is used, include the chosen cap as the final duration bucket passed to OOMptimizer. This +keeps the last bucket aligned with the longest sample that training will actually admit. + +Run the first OOMptimizer pass with its default CLI settings. Do not lower `--memory-fraction`, disable DDP simulation, +change dtype, or adjust the search threshold unless there is a concrete reason. The default profile is intended to be +aggressive enough for high GPU utilization while reserving non-training-loop memory. If the resulting real training run +OOMs, then rerun OOMptimizer with a lower `--memory-fraction` and document why. + +Validate the generated profile with a short multi-GPU pilot and sample GPU utilization during training steps, not just +startup, checkpointing, or validation. OOMptimizer sizes worst-case synthetic batches at the bucket upper bounds; real +training memory can be noticeably lower when the sampler draws shorter cuts or smaller buckets. Focus on peak training +memory and sustained SM utilization over enough steps to exercise several buckets. + +Sample utilization while training is inside the train loop: + +```bash +nvidia-smi --query-gpu=index,utilization.gpu,utilization.memory,memory.used,memory.total \ + --format=csv,noheader,nounits +``` + +Do not judge utilization from checkpoint save, validation, export, dataloader prefill, or process shutdown windows. +Record peak memory and sustained SM utilization in the run ledger. If memory remains much lower than expected, first +confirm the run is using the OOMptimizer `bucket_batch_size` profile and that conflicting batch settings are null. + +For non-tarred data, Lhotse may tokenize samples during sampling when `pretokenize=true`. This enables token-per-second +filtering and 2D token bucketing, but tokenization happens in the main training process and can slow training with large +tokenizers. If the run does not use token-per-second filters or 2D bucketing, consider `pretokenize=false`. + +## Batch Mode Compatibility + +When changing Lhotse batch settings, explicitly null conflicting options. `dataloader.py` accepts these batch sizing +modes: + +- Static batch size: set `batch_size=`, `use_bucketing=false`, and set `batch_duration=null`, + `quadratic_duration=null`, `bucket_duration_bins=null`, `bucket_batch_size=null`, `batch_tokens=null`. +- OOMptimizer profile: set `bucket_duration_bins=[...]` and `bucket_batch_size=[...]`, and set `batch_size=null`, + `batch_duration=null`, `quadratic_duration=null`, `batch_tokens=null`. +- Heuristic dynamic duration batching: set `batch_duration=`, optionally `quadratic_duration=`, and + set `bucket_batch_size=null`, `batch_tokens=null`. Prefer OOMptimizer instead. + +`bucket_batch_size` requires `bucket_duration_bins`. Setting either auto-enables `use_bucketing=true`, but set it +explicitly for clarity. + +## Training Lhotse Defaults + +Use integer `val_check_interval`, `limit_train_batches` as pseudo-epoch length, and `max_steps` as the real duration. +Do not use `trainer.max_epochs`. + +```bash +++model.train_ds.use_lhotse=true \ +++model.train_ds.use_bucketing=true \ +++model.train_ds.batch_size=null \ +++model.train_ds.batch_duration=null \ +++model.train_ds.quadratic_duration=null \ +++model.train_ds.bucket_duration_bins='[...]' \ +++model.train_ds.bucket_batch_size='[...]' \ +++model.train_ds.bucket_buffer_size=10000 \ +++model.train_ds.shuffle_buffer_size=10 \ +++trainer.use_distributed_sampler=false \ ++trainer.limit_train_batches=1000 \ +trainer.val_check_interval=1000 \ +trainer.max_steps= +``` + +Validation should use Lhotse but static batches: + +```bash +++model.validation_ds.use_lhotse=true \ +++model.validation_ds.use_bucketing=false \ +model.validation_ds.batch_size=8 \ +++model.validation_ds.batch_duration=null \ +++model.validation_ds.quadratic_duration=null \ +++model.validation_ds.bucket_duration_bins=null \ +++model.validation_ds.bucket_batch_size=null \ +model.validation_ds.shuffle=false +``` + +Use Hydra `++` for dataloader keys that are not declared in the selected YAML. This commonly applies to Lhotse-specific +validation keys such as `use_lhotse`, `use_bucketing`, `batch_duration`, `bucket_duration_bins`, and sometimes +`min_duration`/`max_duration`. + +## Bucketing Policy + +- For CTC/RNNT/TDT, prefer 1D duration bucketing. +- For AED/Canary, prefer 2D bucketing over duration and token count. +- Strongly prefer OOMptimizer-generated `bucket_batch_size` over manually tuning `batch_duration` and + `quadratic_duration`. +- If all utterances are fixed length, disable bucketing and use static `batch_size`. +- For very small fine-tuning datasets around 100 hours, especially on one GPU, consider disabling bucketing and using + fully random static `batch_size`. + +1D bins and OOMptimizer: + +```bash +python scripts/speech_recognition/estimate_duration_bins.py -b 30 /data/train_input_cfg.yaml +python scripts/speech_recognition/oomptimizer.py \ + --pretrained-name nvidia/parakeet-tdt-0.6b-v2 \ + --buckets '[2.0,3.1,5.6,8.4,12.0,18.0,30.0]' +``` + +If `max_duration` was capped to 30.0, make sure 30.0 is present as the final bucket. + +2D AED/Canary bins and OOMptimizer: + +```bash +python scripts/speech_recognition/estimate_duration_bins_2d.py \ + --prompt-format canary \ + --prompt "[{'role':'user','slots':{'source_lang':'en','target_lang':'en','pnc':'yes'}}]" \ + --tokenizer /data/tokenizers/spl_tokens/tokenizer.model /data/tokenizers/en/tokenizer.model \ + --langs spl_tokens en \ + --buckets 30 \ + --sub-buckets 2 \ + /data/train_input_cfg.yaml + +python scripts/speech_recognition/oomptimizer.py \ + --config-path examples/asr/conf/speech_multitask/fast-conformer_aed.yaml \ + --module-name nemo.collections.asr.models.EncDecMultiTaskModel \ + --buckets '[[3.9,30],[3.9,48],[5.0,37]]' +``` + +Nested `bucket_duration_bins` automatically activate 2D bucketing. + +## Buffers, Memory, And RNG + +- `bucket_buffer_size=10000` is a good default. +- With bucketing enabled, set `shuffle_buffer_size=10`; it is added on top of the bucket buffer. +- With bucketing disabled, set `shuffle_buffer_size=1000` to `10000`, but do not rely on it as the only source of + randomness. Shard the data and blend datasets when applicable. +- With tarred data, larger buffers and more workers directly increase CPU memory pressure. Segfaults, CPU OOM, or + unexplained dataloader errors often indicate CPU memory pressure. +- `seed` controls base dataloading RNGs. +- `shard_seed` controls sharded/tarred randomization. Default `shard_seed="trng"` gives different non-reproducible + orders per run, rank, and worker, but is simpler to manage. Use `shard_seed="randomized"` with a managed `seed` when deterministic + dataloading is needed. For 100% determinism, disable `concurrent_bucketing=false` at the cost of longer tarred data bucket prefill. + +## Data Blends + +Use Lhotse `input_cfg` for mixed datasets rather than concatenating manifests blindly. + +Before running helper scripts such as duration-bin estimation, OOMptimizer, or data-weight estimation, validate the +input YAML shape they expect in the current checkout. Some scripts consume a list-form input config directly, while +training configs may wrap the same list under `input_cfg:`. Run a tiny dry run or inspect the script help before a long +OOMptimizer pass. + +For a large generic dataset plus a smaller domain dataset, either manually upweight the domain data or estimate weights +then apply temperature reweighting. Lower temperature oversamples smaller datasets; `1.0` is neutral. + +For small-domain adaptation, target-domain real data should usually dominate synthetic or heavily augmented data. +Synthetic data can help coverage, but it can also dilute the real-domain signal. Start conservatively, e.g. keep +synthetic sources below roughly 30% total weight, evaluate ablations, and only increase synthetic weight when standalone +domain WER improves. This applies especially when the synthetic data is generated from TTS, noisy augmentation, or +generic prompts rather than real target-domain audio. + +```bash +python scripts/speech_recognition/estimate_data_weights.py \ + generic.yaml domain.yaml blended.yaml \ + --temperature 0.5 \ + --strategy num_hours +``` + +Example: + +```yaml +input_cfg: + - type: nemo + manifest_filepath: /data/generic/manifest__OP_0..512_CL_.json + weight: 0.7 + tags: + domain: generic + - type: nemo + manifest_filepath: /data/domain/manifest__OP_0..128_CL_.json + weight: 0.3 + tags: + domain: target +``` + +For tarred data, use `type: nemo_tarred` with matching `manifest_filepath` and `tarred_audio_filepath`. Avoid mixing +tarred and non-tarred inputs in one Lhotse multi-source setup unless the current dataloader docs say the selected mode +supports it. diff --git a/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/references/evaluation-style-contract.md b/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/references/evaluation-style-contract.md new file mode 100644 index 0000000000000000000000000000000000000000..4cd39ea8277e02277074f2992e0241085dca66e7 --- /dev/null +++ b/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/references/evaluation-style-contract.md @@ -0,0 +1,86 @@ +# Evaluation Style Contract + +Use this reference whenever reporting WER/CER for an ASR fine-tune. + +## Default Metric + +Unless the user explicitly requests a different metric, evaluate WER with capitalization and punctuation removed. This +default keeps model quality comparisons focused on lexical recognition instead of punctuation/casing style drift. + +Still preserve raw prediction manifests. Raw WER is useful as a diagnostic, especially when the fine-tuning labels use +a different style than the original checkpoint, but it is not the default success metric for this skill. + +Change the default only when the user asks for raw/cased/punctuated scoring. If the target product requires +punctuation, casing, ITN, or symbolic formatting to be part of the ASR metric, treat that as an explicit user +requirement and record the changed metric contract. + +## Two-Step Evaluation + +First transcribe with stable decoding, no AMP, and bfloat16 compute: + +```bash +python examples/asr/speech_to_text_eval.py \ + model_path=/exp/asr-ft/checkpoints/best.nemo \ + dataset_manifest=/data/test.json \ + output_filename=/exp/asr-ft/test_predictions.json \ + batch_size=32 \ + amp=false \ + compute_dtype=bfloat16 \ + matmul_precision=high +``` + +For RNNT/TDT, enable CUDA graphs when supported: + +```bash +python examples/asr/speech_to_text_eval.py \ + model_path=/exp/asr-ft/checkpoints/best.nemo \ + dataset_manifest=/data/test.json \ + output_filename=/exp/asr-ft/test_predictions.json \ + batch_size=32 \ + amp=false \ + compute_dtype=bfloat16 \ + matmul_precision=high \ + rnnt_decoding.strategy=greedy_batch \ + rnnt_decoding.greedy.use_cuda_graph_decoder=true +``` + +Then score the saved predictions with the default text-processing contract: + +```bash +python examples/asr/speech_to_text_eval.py \ + dataset_manifest=/exp/asr-ft/test_predictions.json \ + only_score_manifest=true \ + text_processing.do_lowercase=true \ + text_processing.rm_punctuation=true \ + use_cer=false +``` + +The WER printed by the first transcription command is raw unless the same `text_processing` overrides were passed to +that command. Treat the score-only command above as the default metric. + +If the user requested raw scoring, run score-only without `text_processing.do_lowercase` and +`text_processing.rm_punctuation`, and label the result as raw WER. + +## Punctuation Coverage + +`text_processing.rm_punctuation=true` removes the punctuation marks configured in +`text_processing.punctuation_marks`. If predictions contain punctuation or symbols outside that list, either: + +- Override `text_processing.punctuation_marks` with the full set relevant to the target style. +- Or create a derived scored manifest where both `text` and `pred_text` are transformed by the same documented + normalizer, then score that manifest. + +Use the second option when the target style removes broad Unicode punctuation/symbol categories, normalizes whitespace, +or applies language-specific text normalization that NeMo's built-in punctuation helper does not express. + +## Reporting + +For each model variant, report: + +- Default WER/CER from score-only evaluation with capitalization and punctuation removed. +- Raw WER/CER only when it helps explain style mismatch or the user requested it. +- The exact prediction manifest and text-processing settings. +- Whether the target references were raw labels or derived style-normalized labels. + +If raw WER and default WER differ substantially, treat that as a transcript-style finding before changing training +hyperparameters. Do not claim an acoustic/model regression from raw WER alone when the default normalized WER improved. diff --git a/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/references/refinement-iteration.md b/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/references/refinement-iteration.md new file mode 100644 index 0000000000000000000000000000000000000000..9e62d1a7b7c0c42e589caffdfed07dd57e485af6 --- /dev/null +++ b/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/references/refinement-iteration.md @@ -0,0 +1,132 @@ +# Stage 5: Refinement And Iteration + +Use this stage after the first fine-tuning run has a standalone evaluation result. The goal is to decide what to change +next from evidence, not from guesswork. + +## Evaluation Matrix + +Always compare: + +- Baseline pretrained model on the domain validation/test set. +- Fine-tuned model on the same domain validation/test set. + +Add a general or out-of-domain guardrail set only when it matches the user's goal, such as preserving same-language +general ASR quality, broad production behavior, or a known existing benchmark. If the user is intentionally changing +language, task, script, domain, or deployment scope, do not assume a generic guardrail is meaningful; pick validation +sets that reflect the desired behavior. + +Report standalone `speech_to_text_eval.py` WER for each row. In-training `val_wer` is only for checkpoint selection. +For small-domain adaptation, avoid optimizing only one tiny target set when the model must still work broadly; track the +smallest goal-relevant guardrail set that would reveal unacceptable regressions. + +Example tracking table: + +| Run | Checkpoint | Target WER | Optional Guardrail WER | Notes | +| --- | --- | --- | --- | --- | +| baseline | pretrained | | | no fine-tune | +| ft-001 | best single | | | first pass | +| ft-001-avg | averaged | | | keep only if better | + +## Error Analysis Loop + +1. Transcribe the held-out domain set with the current best checkpoint. +2. Compute per-utterance WER/CER and sort from worst to best. +3. Before treating raw WER as acoustic/model quality, rescore with the chosen transcript normalization and compare + raw vs the default capitalization/punctuation-normalized WER. This is mandatory. A large gap usually means the + Stage 2 transcript-style preflight or the evaluation-style contract is incomplete. +4. Categorize errors by actionable patterns: numbers, named entities, abbreviations, rare domain words, commands, + readbacks, punctuation/capitalization, language/task tags, accents, noise, long utterances, and clipping/VAD issues. +5. Count errors by category and inspect representative audio. Separate model errors from label/audio defects. +6. Choose one or two interventions for the next run. Avoid changing LR, data mix, tokenizer, and decoding all at once. + +Do not train on validation or test transcripts. If error analysis uses a public or user-visible test set to guide new +data generation, create a new blind holdout before claiming final quality. + +## Intervention Choices + +Prefer the least invasive intervention that matches the error pattern: + +- Data issue: fix labels/audio, remove broken samples, adjust `min_duration`, `max_duration`, `min_tps`, or `max_tps`. +- Rare vocabulary or entities: add more real examples if available; otherwise add carefully reviewed synthetic examples. +- Overfitting or regression: lower LR, reduce `max_steps`, stop at an earlier checkpoint, or increase a generic/guardrail + blend only when preserving that behavior is part of the user's objective. +- Domain underfitting: raise target-domain real-data weight, add targeted data, or run a lower-LR domain-focus phase. +- Decoding issue: compare decoder options, prompts, punctuation/capitalization settings, or CTC/RNNT head for hybrids. +- Tokenization issue: revisit tokenizer only when transcript language/domain coverage cannot be represented well by the + existing tokenizer. + +## Source-Weighted Rebalancing + +Use source-weighted rebalancing when standalone evaluation shows that a few train sources, domains, or acoustic styles +are underfitting and those sources are important to the user's goal. Do not use it to chase a public test set without a +new blind holdout. + +Recipe: + +1. Ensure every sample has a stable source/domain tag, either in manifest metadata such as `source_dataset` or in + Lhotse `input_cfg.tags`. +2. Run standalone evaluation and compute source-wise WER using the default evaluation-style contract. +3. Decide whether weights should reflect user priority, source-wise validation errors, dataset hours, or a blend of + those signals. +4. Apply a floor so low-error sources are not removed entirely, and cap extreme weight jumps unless the user explicitly + wants domain-only adaptation. +5. Write a new Lhotse `input_cfg` with normalized weights. Prefer changing weights over duplicating manifests. +6. Re-run duration-bin estimation and OOMptimizer, or at least verify the previous profile is still valid when the + source union is unchanged. +7. Fine-tune from the current best checkpoint with a lower LR refinement phase, commonly `1e-5` or `5e-6`. +8. Compare the previous best, the rebalanced final checkpoint, the best individual checkpoint, and any averaged model + with the same standalone scoring contract. + +When using `estimate_data_weights.py`, validate the YAML shape expected by the current script before running it. If the +new weights were influenced by validation/test performance, record that in the ledger. For final claims, evaluate on a +holdout that did not influence the reweighting decision. + +## Targeted Synthetic Data + +Synthetic data is most useful when it fills a measured gap. Generate small, targeted batches for the worst categories +instead of flooding the run with generic synthetic audio. + +Recommendations: + +- Keep synthetic text TTS-friendly: expand symbols and ambiguous abbreviations when needed, and avoid text forms that a + synthesizer will read incorrectly. +- Match target-domain acoustics only when the target deployment needs them; generic noise can hurt. +- Filter synthetic audio with ASR or manual spot checks before adding it to training. +- Add synthetic data as a separately weighted Lhotse input source so it can be ablated. +- For small-domain adaptation, keep real target-domain audio dominant unless standalone WER proves otherwise. + +## Run Ledger + +Use `assets/experiment-ledger-template.md` as the starting template for experiment notes. + +Maintain a compact run ledger with: + +- Data sources and blend weights. +- Transcript style policy, any manifest transform, and whether it differs from the original checkpoint output style. +- LR, `max_steps`, warmup, precision, and batch profile. +- Duration/token filters and number of examples filtered. +- Final `.nemo`, best individual checkpoint-derived artifact, averaged artifact, and the keep/drop decision. +- Raw WER/CER and default capitalization/punctuation-normalized WER/CER when both are informative. +- Target-set WER and any goal-relevant guardrail WER. +- GPU utilization evidence from training steps, not validation/checkpoint/export windows. +- Decision for the next run. + +## Late-Stage Curriculum Pattern + +Use curriculum-style staged fine-tuning only after simpler refinements stop improving standalone WER. Try data cleanup, +filter fixes, blend-weight changes, targeted data additions, decoding choices, and tokenizer decisions first. + +For small-data domain adaptation, use short lower-LR phases instead of one long aggressive run: + +1. Foundation phase: preserve required broad behavior with a mix of source and target-domain data when that is a goal. +2. Domain-focus phase: increase real target-domain and targeted data weight, lower LR. +3. Final refinement phase: lower LR again and evaluate carefully; this phase can regress. + +Typical starting points: + +- First small-domain phase: `model.optim.lr=3e-5`. +- Follow-up domain-focus phase: `model.optim.lr=1e-5`. +- Final refinement phase: `model.optim.lr=5e-6` or lower. + +Use `trainer.max_steps` for each phase, checkpoint by `val_wer`, and run standalone evaluation after each phase. Keep +the best phase, not necessarily the last phase. diff --git a/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/references/setup-checkpoints.md b/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/references/setup-checkpoints.md new file mode 100644 index 0000000000000000000000000000000000000000..106e7d06022c65731e797a9f98f93bf7130557dc --- /dev/null +++ b/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/references/setup-checkpoints.md @@ -0,0 +1,98 @@ +# Stage 1: Setup And Checkpoint Selection + +Default to the NeMo release container. Use local execution only when the user explicitly asks for it. + +Check `README.md`, `docker/Dockerfile.speech`, and the NGC catalog before quoting container tags. The container avoids +most local CUDA, torch, audio backend, `sox`, `ffmpeg`, and `libsndfile` issues. + +When running repo scripts from a mounted source checkout inside a container, ensure Python imports the mounted checkout, +not an unrelated package already installed in the image: + +```bash +export PYTHONPATH=/workspace/NeMo +python -c "import nemo.collections.asr as asr; print(asr.__file__)" +``` + +If the source checkout must be installed in the container, prefer `pip install -e '.[asr]'`. + +For Hugging Face models or datasets that require authentication, verify access before launching long jobs. Containers +often do not include `huggingface-cli`; mounting a populated `HF_HOME` or token/cache directory is usually enough: + +```bash +docker run -e HF_HOME=/tmp/hf_home -v /host/hf_home:/tmp/hf_home ... +``` + +For explicit local setup, verify: + +```bash +python -c "import torch; print(torch.__version__); print(torch.cuda.is_available())" +python -c "import nemo.collections.asr as asr; print(asr.__file__)" +nvidia-smi +``` + +For a source checkout local install, prefer: + +```bash +pip install -e '.[asr]' +``` + +If CUDA, torch, audio backend, or dependency issues appear, steer back to the container. + +## Preflight Checks + +Before launching a long fine-tune, spend a few minutes on cheap failure checks: + +- Confirm the intended NeMo checkout is imported from inside the container. +- Confirm each training/validation manifest exists, has non-empty `text`, valid `audio_filepath`, and usable + `duration` values. +- Run the transcript-style preflight in `data-lhotse.md` before training. Mixed casing, punctuation, number, or symbol + conventions across fine-tuning sources are an experiment setup issue, not a tuning detail. +- Inspect duration and token-per-second distributions before setting filters; Lhotse filtering is silent. +- Check GPU state with `nvidia-smi` and stop stale training processes before sizing batches. +- Check free disk space for experiment logs and checkpoints. Large `.nemo` exports, `save_top_k`, checkpoint averaging, + and EMA can produce tens of GB per run. +- Confirm `HF_HOME`/tokens and any object-store credentials are visible inside the container before launching jobs that + will download checkpoints or data. + +Useful quick checks: + +```bash +nvidia-smi +df -h /exp /tmp /data +python - /data/train.json <<'PY' +import json, pathlib, statistics, sys +manifest = pathlib.Path(sys.argv[1]) +durations, missing_audio, empty_text = [], 0, 0 +for line in manifest.open(): + item = json.loads(line) + if not pathlib.Path(item["audio_filepath"]).exists(): + missing_audio += 1 + if not item.get("text", "").strip(): + empty_text += 1 + if "duration" in item: + durations.append(float(item["duration"])) +print({"items": len(durations), "missing_audio": missing_audio, "empty_text": empty_text}) +if durations: + print({"hours": sum(durations) / 3600, "min": min(durations), "p50": statistics.median(durations), "max": max(durations)}) +PY +``` + +## Checkpoint Candidates + +Use the user's constraints first: language, streaming vs offline, latency, memory budget, punctuation/capitalization, +translation, speaker overlap, CTC alignments, and deployment target. + +Good candidates from local docs: + +- `nvidia/parakeet-tdt-0.6b-v3` or `nvidia/parakeet-tdt-0.6b-v2`: general Parakeet/TDT fine-tuning. Check the + model card for exact language and punctuation support. +- `nvidia/parakeet-tdt_ctc-110m`: compact hybrid candidate. +- `nvidia/parakeet-ctc-0.6b` or `nvidia/parakeet-ctc-1.1b`: CTC when simple non-autoregressive decoding, alignments, + or vocabulary replacement matter. +- `nvidia/nemotron-speech-streaming-en-0.6b`: real-time English streaming. +- `nvidia/multitalker-parakeet-streaming-0.6b-v1`: streaming multi-speaker input. +- `nvidia/canary-1b-v2`: AED/Canary for multilingual ASR, speech translation, and prompt-controlled behavior. +- `nvidia/canary-1b-flash` or `nvidia/canary-180m-flash`: faster Canary-family models. + +Always check current `README.md`, `docs/source/asr/featured_models.rst`, `docs/source/asr/asr_checkpoints.rst`, and +the model card or HF collection before finalizing the checkpoint list. diff --git a/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/references/training-evaluation.md b/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/references/training-evaluation.md new file mode 100644 index 0000000000000000000000000000000000000000..47790931a6ebea9dcc60981feb0614e2c729dc57 --- /dev/null +++ b/western_ai/canada/nemo/.claude/skills/nemo-speech-asr-finetune/references/training-evaluation.md @@ -0,0 +1,216 @@ +# Stage 4: Training, Checkpoint Averaging, And Evaluation + +## Optimizer And Trainer + +Use `trainer.max_steps`, not `trainer.max_epochs`. Use a cosine LR schedule with the same `max_steps` as the trainer. +Choose the initial LR by data size and risk: + +- For large or mixed fine-tuning runs, start with `model.optim.lr=1e-4`, then tune. +- For small domain adaptation, especially below roughly 20 hours of high-value target-domain audio, start around + `3e-5` and watch early validation closely. +- For later refinement phases or unstable/diverging runs, try `1e-5` or lower. + +Set warmup to 1-2% of `trainer.max_steps`. + +```bash ++init_from_pretrained_model= \ +trainer.max_steps=50000 \ ++trainer.limit_train_batches=1000 \ +trainer.val_check_interval=1000 \ +model.optim.lr=1e-4 \ +model.optim.sched.name=CosineAnnealing \ +++model.optim.sched.max_steps=50000 \ +model.optim.sched.warmup_steps=500 \ +model.optim.sched.min_lr=5e-6 +``` + +`examples/asr/speech_to_text_finetune.py` supports `init_from_pretrained_model`, but some fine-tune YAMLs do not +declare that key. Use `+init_from_pretrained_model=...` when Hydra says the key is not in struct. Use `+` or `++` for +other trainer/model keys that are valid for the script but absent from the selected YAML; do not remove the plus just +because a similar key exists in another config. + +Prefer `trainer.precision=bf16-true` for memory savings and larger batch sizes, especially for datasets over 1k +hours. If it diverges or has stability issues, fall back to a more stable precision mode. Prefer `bf16-true` over +`bf16-mixed` as the first bfloat16 option. + +Monitor `val_wer` for all validation runs and checkpoint selection: + +```bash +exp_manager.checkpoint_callback_params.monitor=val_wer \ +exp_manager.checkpoint_callback_params.mode=min \ +exp_manager.checkpoint_callback_params.save_top_k=5 \ +exp_manager.checkpoint_callback_params.always_save_nemo=true +``` + +## Multi-GPU Launch Troubleshooting + +For routine single-node runs, start with the normal Lightning launch (`trainer.devices=`). If a container run +hangs immediately after NCCL registration or one rank restores the model on the wrong GPU before DDP takes ownership, +use `torchrun --nproc_per_node=` with the normal script entry point. Keep `trainer.devices=` and +set `trainer.use_distributed_sampler=false` for Lhotse. + +Container `torchrun` template: + +```bash +docker run --rm --gpus all --ipc=host \ + --ulimit memlock=-1 --ulimit stack=67108864 \ + -e PYTHONPATH=/workspace/NeMo \ + -v /path/to/NeMo:/workspace/NeMo \ + -v /data:/data \ + nemo-speech: bash -lc ' + cd /workspace/NeMo && + torchrun --nproc_per_node=2 examples/asr/speech_to_text_finetune.py \ + +init_from_pretrained_model=nvidia/parakeet-tdt-0.6b-v3 \ + model.train_ds.manifest_filepath=/data/train.json \ + model.validation_ds.manifest_filepath=/data/val.json \ + ++model.train_ds.use_lhotse=true \ + ++model.validation_ds.use_lhotse=true \ + +trainer.use_distributed_sampler=false \ + trainer.devices=2 \ + trainer.max_steps=10000 + ' +``` + +Keep `trainer.num_nodes` for real multi-node jobs only. For single-node container fine-tuning, avoid manual +one-visible-GPU-per-process launch patterns unless the user explicitly asks to debug that environment. + +On systems with NCCL P2P or CUDA memory allocator issues, retry with conservative distributed environment settings +after confirming the job is stuck in communication setup: + +```bash +export NCCL_CUMEM_ENABLE=0 +export NCCL_P2P_DISABLE=1 +``` + +Keep `trainer.sync_batchnorm` the same as it was set in the original model's config unless the user explicitly asks to +change it. + +## Checkpoint Averaging + +At the end of a run, optionally average the N best checkpoints saved by `save_top_k=N`. Then evaluate the averaged +model and keep it only if it beats the best individual checkpoint on validation/test. + +The simple `.nemo` averaging utility averages all non-`-last.ckpt` checkpoints in the same folder as the `.nemo` file, +so control N with `save_top_k`: + +```bash +python scripts/checkpoint_averaging/checkpoint_averaging.py \ + /exp/asr-ft/checkpoints/best.nemo +``` + +This produces `*-averaged.nemo`. If model class loading fails, use the script's `--class_path` or `--import_fname_list` +options. Some checkpoint averaging scripts are marked deprecated in the repo; verify they still work in the current +checkout before relying on them. + +With PyTorch 2.6+, the deprecated averaging utility may fail because `torch.load` defaults to `weights_only=True`. +Only for checkpoints you trust, rerun with: + +```bash +TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD=1 python scripts/checkpoint_averaging/checkpoint_averaging.py \ + /exp/asr-ft/checkpoints/best.nemo +``` + +Do not assume the latest `.nemo` is the best validation checkpoint. `always_save_nemo=true` can overwrite the `.nemo` +artifact on later saves. Check the `.ckpt` filenames and validation logs, then evaluate the exported `.nemo`, the best +checkpoint-derived artifact, and any averaged model before deciding what to keep. + +Decision rule: evaluate the final exported `.nemo`, the best individual validation checkpoint-derived artifact, and the +averaged artifact with the same standalone command and scoring contract. Keep the artifact with the best standalone +default WER. If averaging is worse, record it and drop the averaged artifact. + +Always run the same standalone evaluation command for the baseline model, the final exported `.nemo`, the best +checkpoint-derived artifact, and any averaged model. In-training `val_wer` is useful for checkpoint selection, but it is +not the final number to report. Standalone WER is the fair comparison because it holds decoding options, text +processing, precision, and output scoring constant. + +Evaluate both: + +```bash +python examples/asr/speech_to_text_eval.py \ + model_path=/exp/asr-ft/checkpoints/best.nemo \ + dataset_manifest=/data/val.json \ + output_filename=/exp/asr-ft/val_best.json \ + batch_size=32 \ + amp=false \ + compute_dtype=bfloat16 + +python examples/asr/speech_to_text_eval.py \ + model_path=/exp/asr-ft/checkpoints/best-averaged.nemo \ + dataset_manifest=/data/val.json \ + output_filename=/exp/asr-ft/val_avg.json \ + batch_size=32 \ + amp=false \ + compute_dtype=bfloat16 +``` + +## Evaluation + +Do not use AMP for inference/evaluation. Use `compute_dtype=bfloat16` and `amp=false`. Report standalone +`speech_to_text_eval.py` results for every model variant being compared; do not report only trainer logs. + +Use `evaluation-style-contract.md` for scoring. By default, report WER with capitalization and punctuation removed via +score-only evaluation of the saved prediction manifest. Report raw WER separately only when the user requests it or it +helps diagnose transcript-style mismatch. + +```bash +python examples/asr/speech_to_text_eval.py \ + model_path=/exp/asr-ft/checkpoints/best.nemo \ + dataset_manifest=/data/test.json \ + output_filename=/exp/asr-ft/test_predictions.json \ + batch_size=32 \ + amp=false \ + compute_dtype=bfloat16 \ + matmul_precision=high \ + use_cer=False +``` + +For RNNT/TDT evaluation, enable CUDA graphs when supported: + +```bash +python examples/asr/speech_to_text_eval.py \ + model_path=/exp/asr-ft/checkpoints/best.nemo \ + dataset_manifest=/data/test.json \ + output_filename=/exp/asr-ft/test_predictions.json \ + batch_size=32 \ + amp=false \ + compute_dtype=bfloat16 \ + matmul_precision=high \ + rnnt_decoding.strategy=greedy_batch \ + rnnt_decoding.greedy.use_cuda_graph_decoder=true +``` + +For a hybrid model, compare decoder choices: + +```bash +python examples/asr/speech_to_text_eval.py \ + model_path=/exp/asr-ft/checkpoints/best.nemo \ + dataset_manifest=/data/test.json \ + decoder_type=ctc \ + output_filename=/exp/asr-ft/test_predictions_ctc.json \ + amp=false \ + compute_dtype=bfloat16 + +python examples/asr/speech_to_text_eval.py \ + model_path=/exp/asr-ft/checkpoints/best.nemo \ + dataset_manifest=/data/test.json \ + decoder_type=rnnt \ + output_filename=/exp/asr-ft/test_predictions_rnnt.json \ + amp=false \ + compute_dtype=bfloat16 \ + rnnt_decoding.strategy=greedy_batch \ + rnnt_decoding.greedy.use_cuda_graph_decoder=true +``` + +If predictions already exist: + +```bash +python examples/asr/speech_to_text_eval.py \ + dataset_manifest=/exp/asr-ft/test_predictions.json \ + only_score_manifest=True \ + text_processing.do_lowercase=true \ + text_processing.rm_punctuation=true \ + use_cer=False +``` + +Use `examples/asr/transcribe_speech.py` for direct offline transcription and streaming or chunked inference scripts for +streaming models. diff --git a/western_ai/canada/nemo/.claude/skills/verify/SKILL.md b/western_ai/canada/nemo/.claude/skills/verify/SKILL.md new file mode 100644 index 0000000000000000000000000000000000000000..bb58ccf1d7f8697e464b3945b559f08b420bc7f5 --- /dev/null +++ b/western_ai/canada/nemo/.claude/skills/verify/SKILL.md @@ -0,0 +1,28 @@ +--- +name: verify +description: Run style checks and tests on changed files to verify code quality before committing. +--- + +Run verification on the current changes: + +1. **Find changed files**: + ```bash + git diff --name-only HEAD + ``` + Also include any files you've been editing in this session. + +2. **Style check** on each changed Python file or its parent directory: + ```bash + python setup.py style --scope + ``` + If issues are found, fix them with `--fix` and report what changed. + +3. **Run relevant tests** based on which collection was modified: + - `nemo/collections/asr/` → `pytest tests/collections/asr --download -m "not pleasefixme" -v --timeout=300` + - `nemo/collections/tts/` → `pytest tests/collections/tts --download -m "not pleasefixme" -v --timeout=300` + - `nemo/collections/audio/` → `pytest tests/collections/audio --download -m "not pleasefixme" -v --timeout=300` + - `nemo/collections/speechlm2/` → `pytest tests/collections/speechlm2 -m "not pleasefixme" -v --timeout=300` + - `nemo/collections/common/` → `pytest tests/collections/common -m "not pleasefixme" -v --timeout=300` + - `nemo/core/` → `pytest tests/core -m "not pleasefixme" -v --timeout=300` + +4. **Report results**: summarize passes and failures. For failures, show relevant error output and suggest fixes. diff --git a/western_ai/canada/nemo/.codex/skills b/western_ai/canada/nemo/.codex/skills new file mode 100644 index 0000000000000000000000000000000000000000..454b8427cd757f30dc7fdb9a325d19c399770417 --- /dev/null +++ b/western_ai/canada/nemo/.codex/skills @@ -0,0 +1 @@ +../.claude/skills \ No newline at end of file diff --git a/western_ai/canada/nemo/.coveragerc b/western_ai/canada/nemo/.coveragerc new file mode 100644 index 0000000000000000000000000000000000000000..c410ac52b583b674ac3a50edc11c5b49a83496cb --- /dev/null +++ b/western_ai/canada/nemo/.coveragerc @@ -0,0 +1,40 @@ +[run] +concurrency = thread,multiprocessing +omit = + /tmp/* + /home/TestData/* + /workspace/Megatron-LM/* + nemo/collections/multimodal/* + nemo/collections/multimodal_autoregressive/* + nemo/collections/vision/* + nemo/collections/diffusion/* + nemo/collections/nlp/* + + nemo/collections/asr/* + nemo/collections/speechlm/* + nemo/collections/tts/* + + # omit from audio + nemo/collections/audio/data/data_simulation.py + nemo/collections/audio/metrics/squim.py + nemo/collections/audio/losses/maxine/* + nemo/collections/audio/models/maxine/* + nemo/collections/audio/parts/utils/maxine.py + + nemo/core/* + nemo/collections/common/* + + /workspace/config-3.12.py + /workspace/config-3.py + /workspace/config.py + /workspace/_remote_module_non_scriptable* + +[report] +omit = + /workspace/_remote_module_non_scriptable* + +[paths] +source = + nemo/ + /home/runner/work/NeMo/NeMo/nemo + /workspace/nemo diff --git a/western_ai/canada/nemo/.cursor/skills b/western_ai/canada/nemo/.cursor/skills new file mode 100644 index 0000000000000000000000000000000000000000..454b8427cd757f30dc7fdb9a325d19c399770417 --- /dev/null +++ b/western_ai/canada/nemo/.cursor/skills @@ -0,0 +1 @@ +../.claude/skills \ No newline at end of file diff --git a/western_ai/canada/nemo/.dockerignore b/western_ai/canada/nemo/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..8919b1d378d605926e2259c16d2aa489ff76c093 --- /dev/null +++ b/western_ai/canada/nemo/.dockerignore @@ -0,0 +1,19 @@ +__pycache__ +*.pyc +*.pyo +*.pyd +.Python +env +pip-log.txt +pip-delete-this-directory.txt +.tox +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +*.log +.git +**/*.nemo +**/*.ckpt diff --git a/western_ai/canada/nemo/.flake8 b/western_ai/canada/nemo/.flake8 new file mode 100644 index 0000000000000000000000000000000000000000..3b26adffe5ec468e1db7320200ea5d6f9f68d8d0 --- /dev/null +++ b/western_ai/canada/nemo/.flake8 @@ -0,0 +1,9 @@ +[flake8] +max-line-length = 119 +select = + F541, # f-string without any placeholders + F841, # local variable 'x' is assigned to but never used + F401, # 'x' imported but unused + E741, # ambiguous variable name 'l' + F821, # undefined name 'x' + E266, # too many leading '#' for block comment \ No newline at end of file diff --git a/western_ai/canada/nemo/.flake8.other b/western_ai/canada/nemo/.flake8.other new file mode 100644 index 0000000000000000000000000000000000000000..3b26adffe5ec468e1db7320200ea5d6f9f68d8d0 --- /dev/null +++ b/western_ai/canada/nemo/.flake8.other @@ -0,0 +1,9 @@ +[flake8] +max-line-length = 119 +select = + F541, # f-string without any placeholders + F841, # local variable 'x' is assigned to but never used + F401, # 'x' imported but unused + E741, # ambiguous variable name 'l' + F821, # undefined name 'x' + E266, # too many leading '#' for block comment \ No newline at end of file diff --git a/western_ai/canada/nemo/.flake8.speech b/western_ai/canada/nemo/.flake8.speech new file mode 100644 index 0000000000000000000000000000000000000000..626b8ed414cfa8ba0cf7f513adf1581a239a9211 --- /dev/null +++ b/western_ai/canada/nemo/.flake8.speech @@ -0,0 +1,9 @@ +[flake8] +max-line-length = 119 +select = + F541, # f-string without any placeholders + F841, # local variable 'x' is assigned to but never used + F401, # 'x' imported but unused + E741, # ambiguous variable name 'l' + F821, # undefined name 'x' + E266, # too many leading '#' for block comment diff --git a/western_ai/canada/nemo/.github/CODEOWNERS b/western_ai/canada/nemo/.github/CODEOWNERS new file mode 100644 index 0000000000000000000000000000000000000000..19349ab41207c7f65f6ed07e7df0fe21105eb434 --- /dev/null +++ b/western_ai/canada/nemo/.github/CODEOWNERS @@ -0,0 +1,6 @@ +.github/ @nvidia-nemo/automation +docker/ @nvidia-nemo/automation +requirements/ @nvidia-nemo/automation +pyproject.toml @nvidia-nemo/automation +setup.py @nvidia-nemo/automation +uv.lock @nvidia-nemo/automation diff --git a/western_ai/canada/nemo/.github/ISSUE_TEMPLATE/bug_report.md b/western_ai/canada/nemo/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000000000000000000000000000000000000..f42bf3d5991e1bf6530a3cb8715fac9616e0c7a2 --- /dev/null +++ b/western_ai/canada/nemo/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,42 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** + +A clear and concise description of what the bug is. + +**Steps/Code to reproduce bug** + +Please list *minimal* steps or code snippet for us to be able to reproduce the bug. + +A helpful guide on on how to craft a minimal bug report http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports. + + +**Expected behavior** + +A clear and concise description of what you expected to happen. + +**Environment overview (please complete the following information)** + + - Environment location: [Bare-metal, Docker, Cloud(specify cloud provider - AWS, Azure, GCP, Collab)] + - Method of NeMo install: [pip install or from source]. Please specify exact commands you used to install. + - If method of install is [Docker], provide `docker pull` & `docker run` commands used + +**Environment details** + +If NVIDIA docker image is used you don't need to specify these. +Otherwise, please provide: +- OS version +- PyTorch version +- Python version + +**Additional context** + +Add any other context about the problem here. +Example: GPU model diff --git a/western_ai/canada/nemo/.github/ISSUE_TEMPLATE/config.yml b/western_ai/canada/nemo/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000000000000000000000000000000000000..9ffe82bbb5344812ad662ad0590d46d79144dcf0 --- /dev/null +++ b/western_ai/canada/nemo/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,2 @@ +blank_issues_enabled: false + diff --git a/western_ai/canada/nemo/.github/ISSUE_TEMPLATE/dev_container_bug_report.md b/western_ai/canada/nemo/.github/ISSUE_TEMPLATE/dev_container_bug_report.md new file mode 100644 index 0000000000000000000000000000000000000000..58edaf0b68e4ee4380402a45d6eb4c2cc1b5f1b3 --- /dev/null +++ b/western_ai/canada/nemo/.github/ISSUE_TEMPLATE/dev_container_bug_report.md @@ -0,0 +1,35 @@ +--- +container pulled on date: mm/dd/yyyy +name: Dev container - Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** + +A clear and concise description of what the bug is. + +**Steps/Code to reproduce bug** + +Please list *minimal* steps or code snippet for us to be able to reproduce the bug. + +A helpful guide on on how to craft a minimal bug report http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports. + + +**Expected behavior** + +A clear and concise description of what you expected to happen. + +**Environment overview (please complete the following information)** + + - Environment location: Docker + - Method of install: Please specify exact commands you used to install. + - If method of install is [Docker], provide `docker pull` & `docker run` commands used + +**Additional context** + +Add any other context about the problem here. +Example: GPU model diff --git a/western_ai/canada/nemo/.github/ISSUE_TEMPLATE/feature_request.md b/western_ai/canada/nemo/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000000000000000000000000000000000000..79b0e590520df2f1d12b88297058a17b077fc0cd --- /dev/null +++ b/western_ai/canada/nemo/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,25 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: feature request +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** + +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** + +A clear and concise description of what you want to happen. +Provide a code snippet on how new APIs/changes would be used by others. + +**Describe alternatives you've considered** + +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** + +Add any other context or screenshots about the feature request here. diff --git a/western_ai/canada/nemo/.github/PULL_REQUEST_TEMPLATE.md b/western_ai/canada/nemo/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000000000000000000000000000000000000..9d9f87c797e503402e3df852d9ab9244edf2694b --- /dev/null +++ b/western_ai/canada/nemo/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,57 @@ +> [!IMPORTANT] +> The `Update branch` button must only be pressed in very rare occassions. +> An outdated branch is never blocking the merge of a PR. +> Please reach out to the automation team before pressing that button. + +# What does this PR do ? + +Add a one line overview of what this PR aims to accomplish. + +**Collection**: [Note which collection this PR will affect] + +# Changelog + +- Add specific line by line info of high level changes in this PR. + +# Usage + +- You can potentially add a usage example below + +```python +# Add a code snippet demonstrating how to use this +``` + +# GitHub Actions CI + +The Jenkins CI system has been replaced by GitHub Actions self-hosted runners. + +The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR. +To re-run CI remove and add the label again. +To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run". + +# Before your PR is "Ready for review" + +**Pre checks**: + +- [ ] Make sure you read and followed [Contributor guidelines](https://github.com/NVIDIA/NeMo/blob/main/CONTRIBUTING.md) +- [ ] Did you write any new necessary tests? +- [ ] Did you add or update any necessary documentation? +- [ ] Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc) + - [ ] Reviewer: Does the PR have correct import guards for all optional libraries? + +**PR Type**: + +- [ ] New Feature +- [ ] Bugfix +- [ ] Documentation + +If you haven't finished some of the above items you can still open "Draft" PR. + +## Who can review? + +Anyone in the community is free to review the PR once the checks have passed. +[Contributor guidelines](https://github.com/NVIDIA/NeMo/blob/main/CONTRIBUTING.md) contains specific people who can review PRs to various areas. + +# Additional Information + +- Related to # (issue) diff --git a/western_ai/canada/nemo/.github/actions/cancel-workflow/action.yml b/western_ai/canada/nemo/.github/actions/cancel-workflow/action.yml new file mode 100644 index 0000000000000000000000000000000000000000..3db0d8409e5796b4802a565bf301d8d758a06ef0 --- /dev/null +++ b/western_ai/canada/nemo/.github/actions/cancel-workflow/action.yml @@ -0,0 +1,25 @@ +name: Cancel Workflow +description: > + Cancels the current workflow run, i.e. all jobs. Useful if you want to cancel the rest of the workflow when one job + fails. Note that this will cause the workflow to appear cancelled, not failed. + +# Cancelling the workflow in a post-script (like this: +# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runspost; can also be done with +# this action: https://github.com/webiny/action-post-run, see Git history of this file) wouldn't help the status, it +# would still be cancelled. It actually indeed is, but it would be nicer to set it to failed, but there seems to be no +# way to do this. + +runs: + using: "composite" + steps: + - name: Cancel Workflow + # # Fork PRs won't have a token with write access to Actions, thus won't be able to cancel the workflow. + # if: github.event.pull_request == '' || github.event.pull_request.head.repo.fork == false + shell: bash + run: | + curl --verbose \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ github.token }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel \ No newline at end of file diff --git a/western_ai/canada/nemo/.github/actions/test-template/action.yml b/western_ai/canada/nemo/.github/actions/test-template/action.yml new file mode 100644 index 0000000000000000000000000000000000000000..8b180faf445264c1467d9366de7af5e912e1ff45 --- /dev/null +++ b/western_ai/canada/nemo/.github/actions/test-template/action.yml @@ -0,0 +1,234 @@ +# Copyright (c) 2025, NVIDIA CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: "Test Template" +description: "Template for running NeMo tests in a containerized environment" + +inputs: + runner: + description: "Runner to use for test" + required: true + timeout: + description: "Max runtime of test in minutes" + required: false + default: "10" + script: + description: "Test script to execute" + required: true + after_script: + description: "Script to run after main test" + required: false + default: ":" + is_optional: + description: "Failure will cancel all other tests if set to true" + required: false + default: "false" + is_unit_test: + description: "Upload coverage as unit test" + required: false + default: "false" + tests_to_run: + description: "Tests to run" + required: false + default: '["all"]' + image: + description: "Full image URL with tag (e.g., 766267172432.dkr.ecr.us-east-1.amazonaws.com/nemo-speech:nemo_container-12345)" + required: true + test-data-path: + description: "Host path to mount as /home/TestData inside the container" + required: false + default: /mnt/datadrive/TestData + cpu-only: + description: "Run tests on CPU only" + required: false + default: "false" + test_dir: + description: "Directory under tests/ containing the test scripts" + required: false + default: "functional_tests" +runs: + using: "composite" + steps: + - name: Noop + shell: bash + run: | + chmod -R u+rwX ${{ github.run_id }} + echo "noop" + + - name: Docker system cleanup + shell: bash + run: | + docker system prune -af --filter "until=24h" --filter "label!=nemo.pr_number=${{ github.event.pull_request.number || 0 }}" --force || true + + - name: Docker pull image + shell: bash + run: | + docker pull ${{ inputs.image }} + + - name: Clean repos + shell: bash + run: | + + - name: Create UUID + id: uuid + shell: bash + run: | + echo "id=$(uuidgen)" >> "$GITHUB_OUTPUT" + + - name: Checkout NeMo + uses: actions/checkout@v6 + env: + DIR: ${{ github.run_id }} + with: + path: ${{ github.run_id }}/${{steps.uuid.outputs.id }}/NeMo + + - name: Start container + shell: bash + env: + DIR: ${{ github.run_id }} + run: | + mkdir -p $DIR + + # Map of runner names to GPU device configurations + declare -A GPU_CONFIGS=( + ["myVm-01"]="0,1" + ["myVm-02"]="2,3" + ["myVm-03"]="4,5" + ["myVm-04"]="6,7" + ) + + ARG=("") + if [[ "${{ inputs.cpu-only }}" == "false" ]]; then + ARG=("--runtime=nvidia --gpus all") + fi + + cmd=$(cat <&1 | tee $DIR/err.log + + RUN_TEST_EOF + ) + + echo "timeout_in_seconds=$(( ${{ inputs.timeout }} * 60 ))" | tee -a "$GITHUB_OUTPUT" + echo "$cmd" | tee "$DIR/job.sh" + + - name: Run main script + uses: nick-fields/retry@v3 + with: + timeout_seconds: ${{ steps.create.outputs.timeout_in_seconds }} + max_attempts: 3 + shell: bash + retry_on: timeout + command: /bin/bash ${{ github.run_id }}/job.sh + on_retry_command: /bin/bash ${{ github.run_id }}/retry_job.sh + + - name: Check result + id: check + shell: bash + env: + DIR: ${{ github.run_id }} + run: | + cat $DIR/err.log + + log=$(tail -c 2000 $DIR/err.log | base64 -w 0) + echo "log=$log" >> "$GITHUB_OUTPUT" + + potential_infra_failure=$(cat $DIR/err.log | grep -Eqiw "device" && echo true || echo false) + echo "potential_infra_failure=$potential_infra_failure" >> "$GITHUB_OUTPUT" + + docker exec nemo_container_${{ github.run_id }}_${{ inputs.runner }} coverage combine + docker exec nemo_container_${{ github.run_id }}_${{ inputs.runner }} coverage xml + docker cp nemo_container_${{ github.run_id }}_${{ inputs.runner }}:/workspace/.coverage $DIR/.coverage + docker cp nemo_container_${{ github.run_id }}_${{ inputs.runner }}:/workspace/coverage.xml $DIR/coverage.xml + + coverage_report=coverage-${{ steps.create.outputs.coverage-prefix }}-${{ github.run_id }}-$(python3 -c "import uuid; print(uuid.uuid4())") + echo "coverage_report=$coverage_report" >> "$GITHUB_OUTPUT" + + IS_SUCCESS=$(tail -n 1 $DIR/err.log | grep -q "Finished successfully." && echo "true" || echo "false") + + if [[ "$IS_SUCCESS" == "false" && "${{ inputs.is_optional }}" == "true" ]]; then + echo "::warning:: Test failed, but displayed as successful because it is marked as optional." + IS_SUCCESS=true + fi + + if [[ "$IS_SUCCESS" == "false" ]]; then + echo Test did not finish successfully. + exit 1 + fi + + exit $EXIT_CODE + + - name: Test coverage + shell: bash -x -e -u -o pipefail {0} + run: | + docker exec -t nemo_container_${{ github.run_id }}_${{ inputs.runner }} coverage report -i + + - name: Upload artifacts + uses: actions/upload-artifact@v6 + if: ${{ steps.check.outputs.coverage_report != 'none' }} + with: + name: ${{ steps.check.outputs.coverage_report }} + path: | + ${{ github.run_id }}/coverage.xml + ${{ github.run_id }}/.coverage + include-hidden-files: true + + - name: Container shutdown + if: always() + shell: bash + run: | + docker exec nemo_container_${{ github.run_id }}_${{ inputs.runner }} bash -c "chown -R $(id -u):$(id -g) /workspace" + rm -rf $(pwd)/${{ github.run_id }}/${{steps.uuid.outputs.id }} || true + docker container rm -f nemo_container_${{ github.run_id }}_${{ inputs.runner }} || true diff --git a/western_ai/canada/nemo/.github/copy-pr-bot.yaml b/western_ai/canada/nemo/.github/copy-pr-bot.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9c0eb5edc73ee534f71b7e902a8a1cc52763f078 --- /dev/null +++ b/western_ai/canada/nemo/.github/copy-pr-bot.yaml @@ -0,0 +1,3 @@ +enabled: true +auto_sync_draft: false +auto_sync_ready: true diff --git a/western_ai/canada/nemo/.github/labeler.yml b/western_ai/canada/nemo/.github/labeler.yml new file mode 100644 index 0000000000000000000000000000000000000000..7e93014f7c8d8bbb526656c834d46c50b5ead23a --- /dev/null +++ b/western_ai/canada/nemo/.github/labeler.yml @@ -0,0 +1,41 @@ +ASR: +- nemo/collections/asr/**/* +- examples/asr/**/* +- tutorials/asr/**/* +- docs/source/asr/**/* +- tests/collections/asr/** + +Speaker Tasks: +- examples/speaker_tasks/**/* +- tutorials/speaker_tasks/**/* + +TTS: +- nemo/collections/tts/**/* +- nemo/collections/common/tokenizers/text_to_speech/** +- examples/tts/**/* +- tutorials/tts/**/* +- docs/source/tts/**/* +- scripts/dataset_processing/tts/** +- scripts/tts_dataset_files/** +- tests/collections/tts/** +- tests/collections/common/tokenizers/text_to_speech/** + +Audio: +- nemo/collections/audio/**/* +- examples/audio/**/* +- tutorials/audio/**/* +- docs/source/audio/**/* +- tests/collections/audio/** + +core: +- nemo/core/**/* +- tests/core/** + +common: +- nemo/collections/common/**/* + +CI: +- .github/**/* +- Jenkinsfile +- Dockerfile +- ci.groovy diff --git a/western_ai/canada/nemo/.github/scripts/__init__.py b/western_ai/canada/nemo/.github/scripts/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/western_ai/canada/nemo/.github/scripts/notify.py b/western_ai/canada/nemo/.github/scripts/notify.py new file mode 100644 index 0000000000000000000000000000000000000000..7ccab10e0f7ea86ab4529c7245091a6554c24e5b --- /dev/null +++ b/western_ai/canada/nemo/.github/scripts/notify.py @@ -0,0 +1,79 @@ +# Copyright (c) 2025, NVIDIA CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import os + +import requests +from github import Github + + +def send_slack_notification(): + # Get environment variables + gh_token = os.environ.get('GH_TOKEN') + webhook_url = os.environ.get('SLACK_WEBHOOK') + repository = os.environ.get('REPOSITORY') + run_id = os.environ.get('RUN_ID') + server_url = os.environ.get('SERVER_URL', 'https://github.com') + pr_number = int(os.environ.get('PR_NUMBER', 0)) + branch_name = os.environ.get('BRANCH_NAME') + + # Get failure info from GitHub API + gh = Github(gh_token) + repo = gh.get_repo(repository) + + # Get failed jobs + failed_jobs = [job.name for job in repo.get_workflow_run(int(run_id)).jobs() if job.conclusion == 'failure'] + + if pr_number != 0: + pr = repo.get_pull(pr_number) + + title = f"*<{server_url}/{repository}/pull/{pr_number}|PR#{pr_number}>: {pr.title.replace('`', '')}*" + author = f"<{server_url}/{pr.user.login}|{pr.user.login}>" + branch = f"<{server_url}/{pr.head.repo.full_name}/tree/{pr.head.ref}|{pr.head.ref}>" + else: + title = f"*Run on <{server_url}/{repository}/tree/{branch_name}|{branch_name}>*" + author = "No author" + branch = f"<{server_url}/{repository}/tree/{branch_name}|{branch_name}>" + + blocks = [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": ( + f"{title}\n" + f"• Author: {author}\n" + f"• Branch: {branch}\n" + f"• Pipeline: <{server_url}/{repository}/actions/runs/{run_id}|View Run>\n" + f"• Failed Jobs:\n" + + "\n".join( + [ + f" • <{server_url}/{repository}/actions/runs/{run_id}|{job.split('/')[-1]}>" + for job in failed_jobs + if job.split('/')[-1] != 'Nemo_CICD_Test' + ] + ) + ), + }, + } + ] + + print({"blocks": blocks}) + + # Send to Slack + response = requests.post(webhook_url, json={"blocks": blocks}) + response.raise_for_status() + + +if __name__ == "__main__": + send_slack_notification() diff --git a/western_ai/canada/nemo/.github/workflows/_build_container.yml b/western_ai/canada/nemo/.github/workflows/_build_container.yml new file mode 100644 index 0000000000000000000000000000000000000000..76994fef4d27873a068d5bad577283196427f770 --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/_build_container.yml @@ -0,0 +1,111 @@ +name: ~Build container template +on: + workflow_call: + inputs: + image-name: + required: true + type: string + description: "The name of the image to build" + dockerfile: + required: true + type: string + runner: + required: false + default: nemo-ci-aws-gpu-x2 + type: string + description: "The runner to use for the build" + registry: + required: false + default: 766267172432.dkr.ecr.us-east-1.amazonaws.com + type: string + description: "Container registry" + outputs: + image: + description: "Full image URL (registry/nemo-speech:image-name-run_id)" + value: ${{ jobs.build.outputs.image }} + +permissions: + id-token: write + contents: read + +jobs: + pre-flight: + runs-on: ubuntu-latest + outputs: + build_args: ${{ steps.manifest.outputs.BUILD_ARGS }} + cache-from: ${{ steps.cache_from.outputs.LAST_PRS }} + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Get last merged PR + id: cache_from + env: + GH_TOKEN: ${{ github.token }} + run: | + LAST_PRS=$(gh api graphql -f query=' + query { + repository(owner: "NVIDIA", name: "NeMo") { + pullRequests(states: MERGED, first: 100, orderBy: {field: UPDATED_AT, direction: DESC}) { + nodes { + number + } + } + } + }' | jq -r '.data.repository.pullRequests.nodes[].number' | while read -r number; do + echo "type=registry,ref=${{ inputs.registry }}/nemo-speech:${{ inputs.image-name }}-buildcache-$number,mode=max" + done) + + echo "LAST_PRS<= MAX_CONCURRENCY: + print("Maximum concurrency reached, no new approvals will be made") + exit(0) + + # Get waiting CI workflows for test environment + print("Fetching deployments...") + pending_workflows = filter_cicd_runs(get_workflow_runs("waiting")) + + # Sort deployments by creation date (oldest first) + print("Sorting workflows...") + pending_workflows = sorted(pending_workflows, key=lambda x: x.get("created_at", "")) + + # Process each deployment + print("Processing ...") + for workflow in pending_workflows: + if total_workflows >= MAX_CONCURRENCY: + print("Maximum concurrency reached, stopping approvals") + break + + workflow_id = workflow.get("id") + workflow_name = workflow.get("display_title") or workflow.get("name") or "" + if not workflow_id: + print(f"Skipping workflow without a run id: {workflow_name}") + continue + print(f"Approving workflow {workflow_name} with Run Id: {workflow_id}") + + deployment_url = f"actions/runs/{workflow_id}/pending_deployments" + pending_deployments = make_request(deployment_url) + if not pending_deployments: + print(f"No pending deployments found for workflow {workflow_name}; skipping") + continue + + environment_ids = [] + environment_names = [] + for deployment in pending_deployments: + environment = deployment.get("environment") or {} + environment_id = environment.get("id") + environment_name = environment.get("name") or "" + if not environment_id: + print(f"Skipping deployment without an environment id for workflow {workflow_name}") + continue + + environment_ids.append(environment_id) + environment_names.append(environment_name) + + if not environment_ids: + print(f"No pending deployments with environment ids found for workflow {workflow_name}") + exit(1) + + # Approve the deployment + status_data = { + "environment_ids": environment_ids, + "state": "approved", + "comment": "Automatically approved by queue manager" + } + result = make_request( + deployment_url, + method="POST", + data=status_data, + allow_no_pending_deployments=True, + ) + + if result is None: + print(f"Failed to approve environments {environment_names} for workflow {workflow_name}") + exit(1) + if isinstance(result, dict) and result.get("skipped"): + continue + + total_workflows += 1 + + EOF + notify: + if: failure() + runs-on: ubuntu-latest + needs: [approve-queue] + steps: + - name: Notify + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + SLACK_WEBHOOK_ADMIN: + GITHUB_RUN_ID: ${{ github.run_id }} + GITHUB_REPOSITORY: ${{ github.repository }} + run: | + curl -X POST \ + -H 'Content-type: application/json' \ + --data "{\"text\":\":robot_joy: failed. Please review manually.\n\ncc ${SLACK_WEBHOOK_ADMIN}\"}" \ + $SLACK_WEBHOOK diff --git a/western_ai/canada/nemo/.github/workflows/cicd-main-speech.yml b/western_ai/canada/nemo/.github/workflows/cicd-main-speech.yml new file mode 100644 index 0000000000000000000000000000000000000000..413ad702b7d14178a4b9194b7ad23ce80f478347 --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/cicd-main-speech.yml @@ -0,0 +1,578 @@ +# Copyright (c) 2025, NVIDIA CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: NeMo E2E Speech Tests +on: + workflow_call: + inputs: + test_to_run: + required: true + type: string + image-name: + required: false + default: nemo_container_speech + type: string + runner: + required: false + default: nemo-ci-aws-gpu-x2 + type: string + description: "Runner to use for GPU jobs" + run_nightly: + required: false + default: 'false' + type: string + description: "Set to 'true' to run the nightly e2e suite" + +jobs: + build: + uses: ./.github/workflows/_build_container.yml + with: + image-name: ${{ inputs.image-name }} + dockerfile: docker/Dockerfile + runner: ${{ inputs.runner }} + + unit-tests: + strategy: + fail-fast: false + matrix: + include: + - script: L0_Unit_Tests_GPU_ASR_1 + runner: ${{ inputs.runner }} + timeout: 15 + - script: L0_Unit_Tests_GPU_ASR_2 + runner: ${{ inputs.runner }} + timeout: 15 + - script: L0_Unit_Tests_GPU_ASR_3 + runner: ${{ inputs.runner }} + timeout: 15 + - script: L0_Unit_Tests_GPU_ASR_4 + runner: ${{ inputs.runner }} + timeout: 15 + - script: L0_Unit_Tests_GPU_ASR_5 + runner: ${{ inputs.runner }} + timeout: 15 + - script: L0_Unit_Tests_GPU_ASR_6 + runner: ${{ inputs.runner }} + timeout: 15 + - script: L0_Unit_Tests_CPU_ASR_1 + runner: ${{ inputs.runner }} + cpu-only: true + timeout: 12 + - script: L0_Unit_Tests_CPU_ASR_2 + runner: ${{ inputs.runner }} + cpu-only: true + timeout: 12 + - script: L0_Unit_Tests_CPU_ASR_3 + runner: ${{ inputs.runner }} + cpu-only: true + timeout: 12 + - script: L0_Unit_Tests_CPU_ASR_4 + runner: ${{ inputs.runner }} + cpu-only: true + timeout: 12 + - script: L0_Unit_Tests_CPU_ASR_5 + runner: ${{ inputs.runner }} + cpu-only: true + timeout: 12 + - script: L0_Unit_Tests_CPU_ASR_6 + runner: ${{ inputs.runner }} + cpu-only: true + timeout: 12 + - script: L0_Unit_Tests_GPU_TTS + runner: ${{ inputs.runner }} + timeout: 30 + - script: L0_Unit_Tests_CPU_TTS + runner: ${{ inputs.runner }} + cpu-only: true + - script: L0_Unit_Tests_GPU_Audio_1 + runner: ${{ inputs.runner }} + timeout: 15 + - script: L0_Unit_Tests_GPU_Audio_2 + runner: ${{ inputs.runner }} + timeout: 15 + - script: L0_Unit_Tests_CPU_Audio + runner: ${{ inputs.runner }} + cpu-only: true + timeout: 20 + - script: L0_Unit_Tests_GPU_SpeechLM2 + runner: ${{ inputs.runner }} + timeout: 20 + - script: L0_Unit_Tests_CPU_SpeechLM2_1 + runner: ${{ inputs.runner }} + cpu-only: true + timeout: 12 + - script: L0_Unit_Tests_CPU_SpeechLM2_2 + runner: ${{ inputs.runner }} + cpu-only: true + timeout: 12 + - script: L0_Unit_Tests_CPU_SpeechLM2_3 + runner: ${{ inputs.runner }} + cpu-only: true + timeout: 12 + - script: L0_Unit_Tests_CPU_SpeechLM2_4 + runner: ${{ inputs.runner }} + cpu-only: true + timeout: 12 + needs: [build] + runs-on: ${{ matrix.runner }} + name: ${{ matrix.script }} + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Checkout NeMo + uses: actions/checkout@v6 + with: + path: ${{ github.run_id }} + - name: main + uses: ./.github/actions/test-template + with: + runner: ${{ runner.name }} + script: ${{ matrix.script }} + is_unit_test: true + tests_to_run: ${{ inputs.test_to_run }} + image: ${{ needs.build.outputs.image }} + test-data-path: ${{ vars.DEFAULT_TEST_DATA_PATH || '/mnt/datadrive/TestData' }} + timeout: ${{ matrix.timeout || 10 }} + cpu-only: ${{ matrix.cpu-only || false }} + is_optional: ${{ matrix.is-optional || false }} + + e2e-tests: + strategy: + fail-fast: false + matrix: + include: + - runner: ${{ inputs.runner }} + script: ASR_dev_run_Speech_to_Text + - runner: ${{ inputs.runner }} + script: Optional_ASR_dev_run_Speech_To_Text_Finetuning + is-optional: true + - runner: ${{ inputs.runner }} + script: Optional_ASR_dev_run_Speech_To_Text_HF_Finetuning + is-optional: true + - runner: ${{ inputs.runner }} + script: ASR_dev_run_Speech_to_Text_WPE_-_Conformer + - runner: ${{ inputs.runner }} + script: ASR_dev_run_Speech_to_Text_Hybrid_RNNT_CTC_Prompt + - runner: ${{ inputs.runner }} + script: ASR_dev_run_Speech_to_Text_RNNT_Prompt + - runner: ${{ inputs.runner }} + script: L2_ASR_Multi-dataloader_dev_run_Speech_to_Text_multi-dataloader + - runner: ${{ inputs.runner }} + script: L2_ASR_Multi-dataloader_dev_run_Speech_to_Label_multi-dataloader + - runner: ${{ inputs.runner }} + script: L2_ASR_Adapters_Linear_Adapters + - runner: ${{ inputs.runner }} + script: L2_ASR_Adapters_RelPos_MHA_Adapters + - runner: ${{ inputs.runner }} + script: L2_Speech_to_Text_EMA + - runner: ${{ inputs.runner }} + script: L2_Speech_to_Text_AED + - runner: ${{ inputs.runner }} + script: L2_Speaker_dev_run_Speech_to_Label + - runner: ${{ inputs.runner }} + script: L2_Speech_Estimate_Duration_Bins + - runner: ${{ inputs.runner }} + script: L2_Speech_Estimate_Token_Bins + - runner: ${{ inputs.runner }} + script: L2_Speech_Batch_Size_OOMptimizer + - runner: ${{ inputs.runner }} + script: L2_Speech_Distributed_Batch_Size_OOMptimizer + timeout: 15 + - runner: ${{ inputs.runner }} + script: Optional_L2_Speech_Batch_Size_OOMptimizer_Canary + is-optional: true + - runner: ${{ inputs.runner }} + script: L2_Speech_Transcription_Speech_to_Text_Transcribe + - runner: ${{ inputs.runner }} + script: L2_Speech_Transcription_Speech_to_Text_Streaming_Infer + - runner: ${{ inputs.runner }} + script: L2_Speech_Transcription_Speech_to_Text_Cache_Aware_Infer + - runner: ${{ inputs.runner }} + script: L2_Speech_Transcription_Speech_to_Text_Cache_Aware_with_Prompt_Infer + - runner: ${{ inputs.runner }} + script: L2_Speech_Transcription_Streaming_Inference + - runner: ${{ inputs.runner }} + script: L2_Speech_Transcription_Speech_to_Text_Inference_Boost_GT + - runner: ${{ inputs.runner }} + script: L2_Speech_Transcription_Speech_to_Text_Transcribe_Boost_GT + - runner: ${{ inputs.runner }} + script: L2_Speech_Transcription_Canary_Transcribe_Full_Manifest + - runner: ${{ inputs.runner }} + script: L2_Speech_Transcription_Canary_Transcribe_With_Prompt + - runner: ${{ inputs.runner }} + script: L2_Speech_Transcription_Canary_Transcribe_Audio_Dir + - runner: ${{ inputs.runner }} + script: L2_Speech_Transcription_Canary_Streaming_Full_Manifest + - runner: ${{ inputs.runner }} + script: L2_Longform_Speech_Transcription_Canary_Chunked_Infer_from_Audio_Dir + - runner: ${{ inputs.runner }} + script: L2_Longform_Speech_Transcription_with_TimeStamps_Canary_Chunked_Infer_from_Audio_Dir + - runner: ${{ inputs.runner }} + script: L2_Longform_Speech_Transcription_with_TimeStamps_Canary_Chunked_Infer_from_Manifest + - runner: ${{ inputs.runner }} + script: Speech_Checkpoints_tests + timeout: 20 + - runner: ${{ inputs.runner }} + script: L2_Speaker_dev_run_Speaker_Recognition + - runner: ${{ inputs.runner }} + script: L2_Speaker_dev_run_EndtoEnd_Speaker_Diarization_Sortformer + - runner: ${{ inputs.runner }} + script: L2_Speaker_dev_run_EndtoEnd_Diarizer_Inference + - runner: ${{ inputs.runner }} + script: L2_Speaker_dev_run_Speaker_Diarization_with_ASR_Inference + - runner: ${{ inputs.runner }} + script: L2_Speaker_dev_run_Clustering_Diarizer_Inference + - runner: ${{ inputs.runner }} + script: L2_Speaker_dev_run_Multispeaker_ASR_Data_Simulation + - runner: ${{ inputs.runner }} + script: L2_TTS_Fast_dev_runs_1_FastPitch + - runner: ${{ inputs.runner }} + script: L2_TTS_Fast_dev_runs_1_Hifigan + - runner: ${{ inputs.runner }} + script: L2_G2P_Models_G2P_Conformer_training_evaluation_and_inference + - runner: ${{ inputs.runner }} + script: SPEECHLM_HF_Training_DuplexS2S + - runner: ${{ inputs.runner }} + script: SPEECHLM_HF_Training_DuplexS2SSpeechDecoder + - runner: ${{ inputs.runner }} + script: SPEECHLM_HF_Training_SALM + timeout: 20 + - runner: ${{ inputs.runner }} + script: L2_TTS_Fast_dev_runs_Magpietts_DecoderContext + - runner: ${{ inputs.runner }} + script: L2_TTS_Fast_dev_runs_Magpietts_MultiEncoder + - runner: ${{ inputs.runner }} + script: L2_TTS_Fast_dev_runs_Magpietts_MoE + - runner: ${{ inputs.runner }} + script: L2_TTS_Fast_dev_runs_Magpietts_OnlinePO + - runner: ${{ inputs.runner }} + script: L2_TTS_InferEvaluate_Magpietts_ZeroShot + timeout: 20 + - runner: ${{ inputs.runner }} + script: L2_TTS_InferEvaluate_Magpietts_SeenSpeakers + timeout: 20 + - runner: ${{ inputs.runner }} + script: L2_TTS_InferEvaluatelongform_Magpietts_ZeroShot + timeout: 20 + - runner: ${{ inputs.runner }} + script: L2_TTS_InferEvaluate_Magpietts_MoE_ZeroShot + timeout: 20 + - runner: ${{ inputs.runner }} + script: L2_TTS_InferEvaluatelongform_Magpietts_MoE_ZeroShot + timeout: 20 + - runner: ${{ inputs.runner }} + script: L2_TTS_InferEvaluate_Magpietts_FrameStacking + timeout: 20 + - runner: ${{ inputs.runner }} + script: L2_TTS_Fast_dev_runs_Magpietts_OnlineCFGDistillation + - runner: ${{ inputs.runner }} + script: L2_TTS_Fast_dev_runs_Magpietts_MoE_OnlineCFGDistillation + - runner: ${{ inputs.runner }} + script: L2_TTS_Fast_dev_runs_Magpietts_FrameStacking_OnlineCFGDistillation + - runner: ${{ inputs.runner }} + script: L2_TTS_Fast_dev_runs_EasyMagpietts_Qwen + - runner: ${{ inputs.runner }} + script: L2_TTS_Fast_dev_runs_EasyMagpietts_Nemotron + - runner: ${{ inputs.runner }} + script: L2_TTS_Fast_dev_runs_EasyMagpietts_OnlinePO + timeout: 20 + - runner: ${{ inputs.runner }} + script: L2_TTS_InferEvaluate_EasyMagpietts + timeout: 20 + needs: [build, unit-tests] + runs-on: ${{ matrix.runner }} + name: ${{ matrix.is-optional && 'PLEASEFIXME_' || '' }}${{ matrix.script }} + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Checkout NeMo + uses: actions/checkout@v6 + with: + path: ${{ github.run_id }} + - name: main + uses: ./.github/actions/test-template + with: + runner: ${{ runner.name }} + script: ${{ matrix.script }} + tests_to_run: ${{ inputs.test_to_run }} + image: ${{ needs.build.outputs.image }} + test-data-path: ${{ vars.DEFAULT_TEST_DATA_PATH || '/mnt/datadrive/TestData' }} + timeout: ${{ matrix.timeout || 10 }} + is_optional: ${{ matrix.is-optional || false }} + + e2e-nightly: + if: ${{ github.event_name == 'schedule' || inputs.run_nightly == 'true' }} + strategy: + fail-fast: false + matrix: + include: + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_de_fastconformer_hybrid_large_pc + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_en_fastconformer_hybrid_large_pc + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_es_fastconformer_hybrid_large_pc + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_it_fastconformer_hybrid_large_pc + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_ua_fastconformer_hybrid_large_pc + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_pl_fastconformer_hybrid_large_pc + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_hr_fastconformer_hybrid_large_pc + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_be_fastconformer_hybrid_large_pc + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_fr_fastconformer_hybrid_large_pc + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_ru_fastconformer_hybrid_large_pc + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_nl_fastconformer_hybrid_large_pc + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_fa_fastconformer_hybrid_large + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_ka_fastconformer_hybrid_large_pc + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_kk_ru_fastconformer_hybrid_large + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_ka_fastconformer_hybrid_transducer_ctc_large_streaming_80ms_pc + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_uz_fastconformer_hybrid_large_pc + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_ar_fastconformer_hybrid_large_pc_v1_0 + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_hy_fastconformer_hybrid_large_pc + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_en_fastconformer_hybrid_medium_streaming_80ms_pc + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_en_fastconformer_hybrid_medium_streaming_80ms + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_pt_fastconformer_hybrid_large_pc + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_es_fastconformer_hybrid_large_pc_nc + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_ar_fastconformer_hybrid_large_pcd_v1_0 + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_en_fastconformer_hybrid_large_streaming_multi + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_en_fastconformer_ctc_large + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_en_fastconformer_transducer_large + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_en_fastconformer_ctc_xlarge + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_en_fastconformer_transducer_xlarge + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_en_fastconformer_transducer_xxlarge + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_en_fastconformer_ctc_xxlarge + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__stt_en_fastconformer_tdt_large + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_stt_en_fastconformer_hybrid_large_streaming_1040ms + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_stt_multilingual_fastconformer_hybrid_large_pc_blend_eu + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__parakeet_rnnt_1_1b + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__parakeet_ctc_1_1b + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__parakeet_rnnt_0_6b + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__parakeet_ctc_0_6b + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__parakeet_tdt_1_1b + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__parakeet_tdt_ctc_1_1b + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__parakeet_tdt_ctc_0_6b_ja + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__parakeet_tdt_ctc_110m + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__parakeet_tdt_0_6b_v2 + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__parakeet_rnnt_110m_da_dk + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__parakeet_tdt_0_6b_v3 + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__parakeet_ctc_0_6b_Vietnamese + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__canary_1b + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__canary_1b_flash + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__canary_180m_flash + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__canary_1b_v2 + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__parakeet_realtime_eou_120m_v1 + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__multitalker_parakeet_streaming_0_6b_v1 + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__nemotron_speech_streaming_en_0_6b + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__canary_qwen_2_5b + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__diar_sortformer_4spk_v1 + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__diar_streaming_sortformer_4spk_v2 + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__diar_streaming_sortformer_4spk_v2_1 + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_titanet_large + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__speakerverification_en_titanet_large + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__ssl_en_nest_large_v1_0 + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__ssl_en_nest_xlarge_v1_0 + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_vad_multilingual_marblenet + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_vad_multilingual_frame_marblenet + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__Frame_VAD_Multilingual_MarbleNet_v2_0 + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__se_den_sb_16k_small + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__se_der_sb_16k_small + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__sr_ssl_flowmatching_16k_430m + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_mel_codec_44khz_medium + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_mel_codec_22khz_fullband_medium + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__low_frame_rate_speech_codec_22khz + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__audio_codec_22khz + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__audio_codec_44khz + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__mel_codec_22khz + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__mel_codec_44khz + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__nemo_nano_codec_22khz_1_78kbps_12_5fps + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__nemo_nano_codec_22khz_1_89kbps_21_5fps + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__nemo_nano_codec_22khz_0_6kbps_12_5fps + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__tts_en_fastpitch + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__tts_hifigan + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_nvidia__magpie_tts_multilingual_357m + timeout: 15 + - runner: ${{ inputs.runner }} + script: L2_Model_Support_tts_en_e2e_fastspeech2hifigan + timeout: 15 + needs: [build, unit-tests] + runs-on: ${{ matrix.runner }} + name: ${{ matrix.script }} + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Checkout NeMo + uses: actions/checkout@v6 + with: + path: ${{ github.run_id }} + - name: main + uses: ./.github/actions/test-template + with: + runner: ${{ runner.name }} + script: ${{ matrix.script }} + tests_to_run: ${{ inputs.test_to_run }} + image: ${{ needs.build.outputs.image }} + test-data-path: ${{ vars.DEFAULT_TEST_DATA_PATH || '/mnt/datadrive/TestData' }} + timeout: ${{ matrix.timeout || 10 }} + test_dir: e2e_nightly diff --git a/western_ai/canada/nemo/.github/workflows/cicd-main-unit-tests.yml b/western_ai/canada/nemo/.github/workflows/cicd-main-unit-tests.yml new file mode 100644 index 0000000000000000000000000000000000000000..9bfba9e368a123d88fdd2eb5d41c30b8df8d5092 --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/cicd-main-unit-tests.yml @@ -0,0 +1,126 @@ +# Copyright (c) 2025, NVIDIA CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: NeMo Unit Tests +on: + workflow_call: + inputs: + test_to_run: + required: true + type: string + runner: + required: false + default: nemo-ci-aws-gpu-x2 + type: string + description: "Runner to use for GPU jobs" + container-image: + required: true + type: string + description: "Full image URL with tag for the NeMo container" + +jobs: + collections-common-tests: + strategy: + fail-fast: false + matrix: + include: + - script: L0_Unit_Tests_GPU_Common + runner: ${{ inputs.runner }} + - script: L0_Unit_Tests_CPU_Common + runner: ${{ inputs.runner }} + cpu-only: true + runs-on: ${{ matrix.runner }} + name: ${{ matrix.script }} + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Checkout NeMo + uses: actions/checkout@v6 + with: + path: ${{ github.run_id }} + - name: main + uses: ./.github/actions/test-template + with: + runner: ${{ runner.name }} + script: ${{ matrix.script }} + is_unit_test: true + tests_to_run: ${{ inputs.test_to_run }} + image: ${{ inputs.container-image }} + test-data-path: ${{ vars.DEFAULT_TEST_DATA_PATH || '/mnt/datadrive/TestData' }} + cpu-only: ${{ matrix.cpu-only || false }} + + core-tests: + strategy: + fail-fast: false + matrix: + include: + - script: L0_Unit_Tests_GPU_Core + runner: ${{ inputs.runner }} + - script: L0_Unit_Tests_CPU_Core + runner: ${{ inputs.runner }} + cpu-only: true + - script: L0_Unit_Tests_GPU_Hydra + runner: ${{ inputs.runner }} + - script: L0_Unit_Tests_CPU_Hydra + runner: ${{ inputs.runner }} + cpu-only: true + runs-on: ${{ matrix.runner }} + name: ${{ matrix.script }} + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Checkout NeMo + uses: actions/checkout@v6 + with: + path: ${{ github.run_id }} + - name: main + uses: ./.github/actions/test-template + with: + runner: ${{ runner.name }} + script: ${{ matrix.script }} + is_unit_test: true + tests_to_run: ${{ inputs.test_to_run }} + image: ${{ inputs.container-image }} + test-data-path: ${{ vars.DEFAULT_TEST_DATA_PATH || '/mnt/datadrive/TestData' }} + cpu-only: ${{ matrix.cpu-only || false }} + + other-tests: + strategy: + fail-fast: false + matrix: + include: + - script: L0_Unit_Tests_GPU_Others + runner: ${{ inputs.runner }} + - script: L0_Unit_Tests_CPU_Others + runner: ${{ inputs.runner }} + cpu-only: true + runs-on: ${{ matrix.runner }} + name: ${{ matrix.script }} + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Checkout NeMo + uses: actions/checkout@v6 + with: + path: ${{ github.run_id }} + - name: main + uses: ./.github/actions/test-template + with: + runner: ${{ runner.name }} + script: ${{ matrix.script }} + is_unit_test: true + tests_to_run: ${{ inputs.test_to_run }} + image: ${{ inputs.container-image }} + test-data-path: ${{ vars.DEFAULT_TEST_DATA_PATH || '/mnt/datadrive/TestData' }} + cpu-only: ${{ matrix.cpu-only || false }} + is_optional: ${{ matrix.is-optional || false }} diff --git a/western_ai/canada/nemo/.github/workflows/cicd-main.yml b/western_ai/canada/nemo/.github/workflows/cicd-main.yml new file mode 100644 index 0000000000000000000000000000000000000000..248f01c2649728625f7b283c5ca925d76c737ba6 --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/cicd-main.yml @@ -0,0 +1,416 @@ +# Copyright (c) 2025, NVIDIA CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: CICD NeMo +on: + schedule: + - cron: 0 0 * * * + push: + branches: + - main + - r** + - weekly-bump* + - "pull-request/[0-9]+" + workflow_dispatch: + inputs: + test_to_run: + required: false + default: all + type: string + description: Comma-separated list of tests to run. Use "all" to run the full test suite. + +concurrency: + # group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }}-${{ github.event_name }} + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: true + +jobs: + pre-flight: + uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/_cicd_preflight.yml@v0.89.0 + with: + default_runner_prefix: ${{ vars.DEFAULT_RUNNER_PREFIX }} + non_nvidia_runner_prefix: ${{ vars.NON_NVIDIA_RUNNER_PREFIX }} + default_test_data_path: ${{ vars.DEFAULT_TEST_DATA_PATH }} + non_nvidia_test_data_path: ${{ vars.NON_NVIDIA_TEST_DATA_PATH }} + default_registry: ${{ vars.DEFAULT_CONTAINER_REGISTRY }} + non_nvidia_registry: ${{ vars.NON_NVIDIA_CONTAINER_REGISTRY }} + sso_users_filename: ${{ vars.SSO_USERS_FILENAME }} + secrets: + NVIDIA_MANAGEMENT_ORG_PAT: ${{ secrets.NVIDIA_MANAGEMENT_ORG_PAT }} + + configure: + runs-on: ubuntu-latest + needs: [pre-flight] + outputs: + test_to_run: ${{ steps.test_to_run.outputs.main }} + is_ci_workload: ${{ steps.is_ci_workload.outputs.main }} + no_fail_fast: ${{ steps.no_fail_fast.outputs.main }} + components_to_run: ${{ steps.components_to_run.outputs.main }} + run_nightly: ${{ steps.pr_labels.outputs.run_nightly }} + skip_docs: ${{ steps.pr_labels.outputs.skip_docs }} + skip_linting: ${{ steps.pr_labels.outputs.skip_linting }} + env: + TESTS_TO_RUN: ${{ inputs.test_to_run }} + EVENT_NAME: ${{ github.event_name }} + steps: + - name: Checkout branch + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Select components to run + id: components_to_run + run: | + echo "main=[\"speech\"]" | tee -a "$GITHUB_OUTPUT" + + - name: Select tests to run + id: test_to_run + run: | + # For manual dispatch, use the provided input + if [[ "$EVENT_NAME" == "workflow_dispatch" ]]; then + TESTS_TO_RUN=$TESTS_TO_RUN + + # For push (PR branches via copy-pr-bot, main, release) and schedule, run all tests + elif [[ "$EVENT_NAME" == "push" || "$EVENT_NAME" == "schedule" ]]; then + TESTS_TO_RUN=all + + else + echo "Unsupported event_name $EVENT_NAME provided". + exit 1 + fi + + parsed_string=$(echo "$TESTS_TO_RUN" | jq -c --raw-input 'split(",")') + echo "main=${parsed_string}" | tee -a "$GITHUB_OUTPUT" + + - name: Check if this is a CI workload + shell: bash + id: is_ci_workload + run: | + branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} + + if [[ "$branch_name" =~ ^bump-ci-container || "$EVENT_NAME" == "schedule" ]]; then + is_ci_workload=true + echo "main=true" | tee -a "$GITHUB_OUTPUT" + else + is_ci_workload=false + fi + + echo "main=$is_ci_workload" | tee -a "$GITHUB_OUTPUT" + + - name: Fetch PR labels + id: pr_labels + env: + GH_TOKEN: ${{ github.token }} + REPO: ${{ github.repository }} + run: | + REF="${GITHUB_REF#refs/heads/}" + if [[ "$REF" =~ ^pull-request/([0-9]+)$ ]]; then + PR_NUMBER="${BASH_REMATCH[1]}" + LABELS=$(gh pr view "$PR_NUMBER" --repo "$REPO" --json labels -q '[.labels[].name]') + else + LABELS='[]' + fi + echo "run_nightly=$(echo "$LABELS" | jq 'any(. == "Run e2e nightly")')" | tee -a "$GITHUB_OUTPUT" + echo "skip_docs=$(echo "$LABELS" | jq 'any(. == "skip-docs")')" | tee -a "$GITHUB_OUTPUT" + echo "skip_linting=$(echo "$LABELS" | jq 'any(. == "skip-linting")')" | tee -a "$GITHUB_OUTPUT" + echo "no_fail_fast=$(echo "$LABELS" | jq 'any(. == "no-fail-fast")')" | tee -a "$GITHUB_OUTPUT" + + - name: Check if no-fail-fast is set + shell: bash + id: no_fail_fast + env: + HAS_FAIL_FAST_LABEL: ${{ steps.pr_labels.outputs.no_fail_fast }} + run: | + if [[ "$HAS_FAIL_FAST_LABEL" == "true" || "$EVENT_NAME" == "schedule" ]]; then + no_fail_fast=true + else + no_fail_fast=false + fi + + echo "main=$no_fail_fast" | tee -a "$GITHUB_OUTPUT" + + code-linting: + if: needs.configure.outputs.test_to_run != '[]' + needs: [configure] + uses: ./.github/workflows/code-linting.yml + with: + skip_docs: ${{ needs.configure.outputs.skip_docs }} + skip_linting: ${{ needs.configure.outputs.skip_linting }} + + cicd-wait-in-queue: + needs: [configure, code-linting] + runs-on: ubuntu-latest + environment: test + if: | + needs.configure.outputs.test_to_run != '[]' + && needs.configure.outputs.components_to_run != '[]' + && needs.configure.outputs.is_ci_workload == 'false' + steps: + - name: Running CI tests + run: | + echo "Running CI tests" + + cicd-test-container-build: + uses: ./.github/workflows/_build_container.yml + needs: [pre-flight, configure, code-linting, cicd-wait-in-queue] + if: | + needs.configure.outputs.test_to_run != '[]' + && needs.configure.outputs.components_to_run != '[]' + && ( + success() + || ( + needs.cicd-wait-in-queue.result == 'skipped' + && needs.configure.outputs.is_ci_workload == 'true' + ) + ) + && !cancelled() + with: + image-name: nemo_container + dockerfile: docker/Dockerfile + runner: ${{ needs.pre-flight.outputs.runner_prefix }} + registry: ${{ needs.pre-flight.outputs.registry }} + + cicd-import-tests: + if: | + needs.configure.outputs.test_to_run != '[]' + && needs.configure.outputs.components_to_run != '[]' + && ( + success() + || ( + needs.cicd-wait-in-queue.result == 'skipped' + && needs.configure.outputs.is_ci_workload == 'true' + ) + ) + && !cancelled() + needs: [cicd-test-container-build, configure, pre-flight] + runs-on: ${{ needs.pre-flight.outputs.runner_prefix }} + steps: + - name: Create UUID + id: uuid + run: | + echo "id=$(uuidgen)" >> "$GITHUB_OUTPUT" + + - name: Checkout NeMo + uses: actions/checkout@v6 + with: + path: ${{ github.run_id }}/${{steps.uuid.outputs.id }}/NeMo + + - name: Run some checks + run: | + docker run \ + --rm \ + --device=/dev/nvidia0 \ + --gpus all \ + --shm-size=8g \ + --volume $(pwd)/${{ github.run_id }}/${{steps.uuid.outputs.id }}/NeMo:/workspace \ + --env TRANSFORMERS_OFFLINE=0 \ + --env HYDRA_FULL_ERROR=1 --env PYTHONUNBUFFERED=1 ${{ needs.cicd-test-container-build.outputs.image }} bash -c '\ + # PyTorch Lightning version + python -c "import lightning.pytorch; print(lightning.pytorch.__version__)" + + # Basic Import Checks + python tests/core_ptl/check_imports.py --domain asr + python tests/core_ptl/check_imports.py --domain tts + ' + + L0_Setup_Test_Data_And_Models: + needs: [configure, cicd-test-container-build, cicd-wait-in-queue, pre-flight] + runs-on: ${{ needs.pre-flight.outputs.runner_prefix }} + if: | + needs.configure.outputs.test_to_run != '[]' + && needs.configure.outputs.components_to_run != '[]' + && ( + success() + || ( + needs.cicd-wait-in-queue.result == 'skipped' + && needs.configure.outputs.is_ci_workload == 'true' + ) + ) + && !cancelled() + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Checkout NeMo + uses: actions/checkout@v6 + with: + path: ${{ github.run_id }} + + - name: main + uses: ./.github/actions/test-template + with: + runner: ${{ runner.name }} + script: L0_Setup_Test_Data_And_Models + tests_to_run: '["L0_Setup_Test_Data_And_Models"]' + image: ${{ needs.cicd-test-container-build.outputs.image }} + test-data-path: ${{ vars.DEFAULT_TEST_DATA_PATH || '/mnt/datadrive/TestData' }} + + cicd-main-unit-tests: + needs: [pre-flight, configure, cicd-test-container-build] + uses: ./.github/workflows/cicd-main-unit-tests.yml + if: | + needs.configure.outputs.test_to_run != '[]' + && needs.configure.outputs.components_to_run != '[]' + && ( + success() + || ( + needs.cicd-wait-in-queue.result == 'skipped' + && needs.configure.outputs.is_ci_workload == 'true' + ) + ) + && !cancelled() + with: + test_to_run: ${{ needs.configure.outputs.test_to_run }} + runner: ${{ needs.pre-flight.outputs.runner_prefix }} + container-image: ${{ needs.cicd-test-container-build.outputs.image }} + + cicd-main-speech: + needs: [pre-flight, configure, cicd-test-container-build, cicd-main-unit-tests] + uses: ./.github/workflows/cicd-main-speech.yml + if: | + ( + needs.configure.outputs.test_to_run != '[]' + && ( + contains(fromJson(needs.configure.outputs.components_to_run), 'speech') + ) + ) + && ( + success() + || ( + needs.cicd-wait-in-queue.result == 'skipped' + && needs.configure.outputs.is_ci_workload == 'true' + ) + ) + && !cancelled() + with: + test_to_run: ${{ needs.configure.outputs.test_to_run }} + runner: ${{ needs.pre-flight.outputs.runner_prefix }} + run_nightly: ${{ needs.configure.outputs.run_nightly }} + + Nemo_CICD_Test: + needs: + - configure + - cicd-test-container-build + - cicd-import-tests + - L0_Setup_Test_Data_And_Models + - cicd-main-unit-tests + - cicd-main-speech + if: always() + runs-on: ubuntu-latest + permissions: write-all + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Get workflow result + id: result + env: + GH_TOKEN: ${{ github.token }} + RUN_ID: ${{ github.run_id }} + run: | + # Get workflow run details and check job conclusions + LATEST_ATTEMPT=$(gh run view $RUN_ID --json jobs -q '[.jobs[] | select(.conclusion != null) | .conclusion] | last') + NUM_FAILED=$(gh run view $RUN_ID --json jobs -q '[.jobs[] | select(.conclusion == "failure") | .name] | length') + NUM_CANCELLED=$(gh run view $RUN_ID --json jobs -q '[.jobs[] | select(.conclusion == "cancelled") | .name] | length') + + if [[ $NUM_FAILED -eq 0 && $NUM_CANCELLED -eq 0 ]]; then + RESULT="success" + elif [[ $NUM_CANCELLED -gt 0 ]]; then + RESULT="cancelled" + else + RESULT="failure" + fi + + # Output the final status + echo "code=$RESULT" | tee -a $GITHUB_OUTPUT + + - name: Pipeline successful, add PR comment + if: | + steps.result.outputs.code == 'success' + && github.event_name == 'push' + && startsWith(github.ref, 'refs/heads/pull-request/') + && env.SLACK_WEBHOOK != '' + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + REPOSITORY: ${{ github.repository }} + RUN_ID: ${{ github.run_id }} + GH_TOKEN: ${{ github.token }} + run: | + PR_NUMBER="${GITHUB_REF#refs/heads/pull-request/}" + PR_AUTHOR=$(gh pr view "$PR_NUMBER" --repo "$REPOSITORY" --json author -q '.author.login') + gh pr comment "$PR_NUMBER" --repo "$REPOSITORY" --body "[🤖]: Hi @${PR_AUTHOR} 👋, + + We wanted to let you know that a [CICD pipeline](https://github.com/${REPOSITORY}/actions/runs/${RUN_ID}) for this PR just finished successfully. + + So it might be time to merge this PR or get some approvals." + + - name: Exit + if: ${{ always() }} + env: + RESULT: ${{ steps.result.outputs.code }} + run: | + if [ $RESULT == "success" ]; then + exit 0 + else + exit 1 + fi + + Coverage: + runs-on: ubuntu-latest + needs: [configure, Nemo_CICD_Test] + if: | + needs.configure.outputs.test_to_run != '[]' + && needs.configure.outputs.components_to_run != '[]' + && ( + success() + || needs.Nemo_CICD_Test.result == 'success' + ) + && !cancelled() + strategy: + matrix: + flag: [unit-test, e2e] + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Download coverage reports of current branch + uses: actions/download-artifact@v7 + with: + pattern: coverage-${{ matrix.flag }}-* + + - name: Get total coverage of current branch + shell: bash -x -e -u -o pipefail {0} + if: always() + run: | + pip install coverage + + ls -al . + ls -al coverage-*/ + coverage combine --keep $(ls coverage-*/.coverage) + coverage report -i + rm -rf coverage-* + ls -al + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + flags: ${{ matrix.flag }} + + - name: Upload artifacts + uses: actions/upload-artifact@v6 + with: + name: coverage-${{ matrix.flag }}-aggregated + path: | + .coverage + include-hidden-files: true diff --git a/western_ai/canada/nemo/.github/workflows/claude-answer.yml b/western_ai/canada/nemo/.github/workflows/claude-answer.yml new file mode 100644 index 0000000000000000000000000000000000000000..f132a5ad44c84cfab23840cdf1a304795196d333 --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/claude-answer.yml @@ -0,0 +1,70 @@ +name: Claude Answer Issue + +on: + issue_comment: + types: [created] + +permissions: + contents: read + issues: write + id-token: write + +jobs: + authorize: + if: >- + !github.event.issue.pull_request && + contains(github.event.comment.body, '/claude answer') + runs-on: ubuntu-latest + steps: + - name: Check team membership + uses: actions/github-script@v8 + with: + github-token: ${{ secrets.ORG_TEAM_READ_TOKEN }} + script: | + const username = context.payload.comment.user.login; + try { + const res = await github.rest.teams.getMembershipForUserInOrg({ + org: 'NVIDIA-NeMo', + team_slug: 'speech_team', + username, + }); + if (res.data.state !== 'active') { + core.setFailed(`${username} is not an active member of NVIDIA Speech Team`); + } + } catch (e) { + core.setFailed(`${username} is not a member of NVIDIA Speech Team`); + } + + acknowledge: + needs: authorize + runs-on: ubuntu-latest + steps: + - name: Add eyes reaction to comment + uses: actions/github-script@v8 + with: + script: | + await github.rest.reactions.createForIssueComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: context.payload.comment.id, + content: 'eyes' + }); + + claude-answer: + needs: acknowledge + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: anthropics/claude-code-action@v1 + env: + ANTHROPIC_BASE_URL: ${{ secrets.NVIDIA_INFERENCE_URL }} + CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS: "1" + DISABLE_PROMPT_CACHING: "1" + with: + prompt: | + You are a helpful assistant for the NeMo repository. + Answer the user's question based on the issue description, comments, and the codebase. + Be concise and provide code references where relevant. + Do NOT make any code changes or create PRs — only answer the question. + anthropic_api_key: ${{ secrets.NVIDIA_INFERENCE_KEY }} + claude_args: --model "${{ vars.CLAUDE_MODEL }}" diff --git a/western_ai/canada/nemo/.github/workflows/claude-babysit-pr.yml b/western_ai/canada/nemo/.github/workflows/claude-babysit-pr.yml new file mode 100644 index 0000000000000000000000000000000000000000..71369d6c783b55891c9fd5bd025c8b90cb39666a --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/claude-babysit-pr.yml @@ -0,0 +1,648 @@ +# PR Babysitter — half-autonomous CI fix loop, speech_team-only. +# +# Master switch: the "Has Babysitter" label. Adding it activates, removing +# it deactivates and cancels any in-flight work. +# +# Authorization model: +# - The entire workflow is restricted to the NVIDIA-NeMo/speech_team team. +# Every job that mutates state starts with a preflight that verifies the +# acting user (label sender / comment author / review author) is an active +# speech_team member. Non-members cause the job to post a refusal comment +# and revert the triggering label, leaving no misleading state behind. +# - The workflow never runs for PRs from forks. Every PR-scoped job +# fork-guards on head.repo.full_name == github.repository. +# +# Lifecycle (all participants must be speech_team members): +# 1. "Has Babysitter" added -> activate posts a takeover comment and adds +# "Run CICD" to start the pipeline. +# 2. CI runs (CICD NeMo workflow). +# 3. If all checks pass -> babysitter stays silent, done. +# If a CI workflow fails -> workflow_run completion event triggers +# investigate-and-propose. The Isort+Black +# workflow isn't in the trigger list — it +# auto-pushes its own fixes. +# 4. investigate-and-propose: Claude investigates root cause, posts a *plan +# comment* on the PR (tagged with ``), and adds +# "Agent Plan Awaiting Approval". It does NOT push code. +# 5. The PR author (who must also be speech_team) approves by replying with a +# comment that mentions `@claude` affirmatively (e.g. `@claude go ahead`). +# evaluate-comment-approval classifies the reply via an LLM and, on APPROVE, +# swaps "Agent Plan Awaiting Approval" for "Agent Plan Approved". +# 6. "Agent Plan Approved" added -> execute-fix verifies the sender is +# speech_team, verifies a bot-authored plan comment exists, then reads the +# plan, pushes the fix, re-adds "Run CICD", and goes back to #2. +# +# Termination: +# - "Has Babysitter" removed at any time -> deactivate cancels in-progress +# work via a shared concurrency group and clears plan-state labels. +# - Claude can't investigate or can't execute -> ping-author-on-failure pings +# the author and clears labels. +# +# Additionally, speech_team members can @claude in a PR review comment on a +# babysitter-enabled PR to ask questions or request changes. +# +# Required secrets: NVIDIA_INFERENCE_URL, NVIDIA_INFERENCE_KEY, ORG_TEAM_READ_TOKEN, NEMO_RELABEL_TOKEN + +name: Claude Code — PR Babysitter + +on: + pull_request: + types: [labeled, unlabeled] + pull_request_review_comment: + types: [created] + pull_request_review: + types: [submitted] + # `workflow_run` rather than `check_run`: check-runs produced by GHA jobs + # authenticated with GITHUB_TOKEN do not fire `check_run` events on + # downstream workflows (GitHub's recursion guard), so the babysitter never + # saw real CI failures. `workflow_run` bypasses that restriction. + # Omitted intentionally: "Isort and Black Formatting" (auto-pushes fixes), + # this workflow itself, and labeler/relabel bots. + workflow_run: + workflows: + - "CICD NeMo" + - "PyLint and flake8 linting" + - "Build, test, and publish a PyPi wheel (to testpypi)." + - "Check __init__ files" + - "Copyright check" + - "CI-Install-Check" + - "CodeQL" + - "Secrets detector" + types: [completed] + issue_comment: + types: [created] + +permissions: + contents: write + pull-requests: write + issues: write + id-token: write + +jobs: + # ---- Activation: one-time setup when "Has Babysitter" is added ---- + + activate: + if: >- + github.event_name == 'pull_request' && + github.event.action == 'labeled' && + github.event.label.name == 'Has Babysitter' && + github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + concurrency: + group: babysit-activate-${{ github.event.pull_request.number }} + cancel-in-progress: true + steps: + # Preflight: only speech_team members may enable the babysitter. If a + # non-member adds the label, revert it and explain. + - name: Verify label sender is speech_team + id: authz + uses: actions/github-script@v8 + with: + github-token: ${{ secrets.ORG_TEAM_READ_TOKEN }} + script: | + const username = context.payload.sender.login; + try { + const res = await github.rest.teams.getMembershipForUserInOrg({ + org: 'NVIDIA-NeMo', + team_slug: 'speech_team', + username, + }); + if (res.data.state !== 'active') { + core.setOutput('authorized', 'false'); + return; + } + core.setOutput('authorized', 'true'); + } catch (e) { + core.setOutput('authorized', 'false'); + } + + - name: Checkout for GH CLI + uses: actions/checkout@v6 + + - name: Refuse activation from non-speech_team sender + if: steps.authz.outputs.authorized != 'true' + env: + GH_TOKEN: ${{ secrets.NEMO_RELABEL_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + SENDER: ${{ github.event.sender.login }} + run: | + gh pr comment "$PR_NUMBER" --body \ + "@${SENDER} the PR Babysitter is restricted to the NVIDIA-NeMo \`speech_team\`. Removing the \`Has Babysitter\` label." + gh pr edit "$PR_NUMBER" --remove-label "Has Babysitter" + exit 0 + + - name: Post takeover comment + if: steps.authz.outputs.authorized == 'true' + uses: actions/github-script@v8 + with: + script: | + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + body: "I'll monitor this PR until CI is green. I'll post a plan for any fix and wait for your approval before pushing anything. Ping me by removing 'Has Babysitter' to cancel." + }); + + - name: Trigger CI + if: steps.authz.outputs.authorized == 'true' + env: + GH_TOKEN: ${{ secrets.NEMO_RELABEL_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + run: gh pr edit "$PR_NUMBER" --add-label "Run CICD" + + # ---- @claude mentions in PR reviews (speech_team only) ---- + + authorize-review: + if: >- + github.event.pull_request.head.repo.full_name == github.repository && + ((github.event_name == 'pull_request_review_comment' && + contains(github.event.comment.body, '@claude') && + contains(github.event.pull_request.labels.*.name, 'Has Babysitter')) || + (github.event_name == 'pull_request_review' && + contains(github.event.review.body, '@claude') && + contains(github.event.pull_request.labels.*.name, 'Has Babysitter'))) + runs-on: ubuntu-latest + steps: + - name: Check team membership + uses: actions/github-script@v8 + with: + github-token: ${{ secrets.ORG_TEAM_READ_TOKEN }} + script: | + const username = + context.payload.comment?.user?.login || + context.payload.review?.user?.login; + try { + const res = await github.rest.teams.getMembershipForUserInOrg({ + org: 'NVIDIA-NeMo', + team_slug: 'speech_team', + username, + }); + if (res.data.state !== 'active') { + core.setFailed(`${username} is not an active member of NVIDIA Speech Team`); + } + } catch (e) { + core.setFailed(`${username} is not a member of NVIDIA Speech Team`); + } + + acknowledge-review: + needs: authorize-review + runs-on: ubuntu-latest + steps: + - name: Add eyes reaction + uses: actions/github-script@v8 + with: + script: | + if (context.payload.comment) { + await github.rest.reactions.createForPullRequestReviewComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: context.payload.comment.id, + content: 'eyes' + }); + } + + respond-to-review: + needs: acknowledge-review + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - uses: anthropics/claude-code-action@v1 + env: + ANTHROPIC_BASE_URL: ${{ secrets.NVIDIA_INFERENCE_URL }} + CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS: "1" + DISABLE_PROMPT_CACHING: "1" + with: + anthropic_api_key: ${{ secrets.NVIDIA_INFERENCE_KEY }} + # No prompt — Claude reads the @claude mention and responds in context + claude_args: "--max-turns 15 --model ${{ vars.CLAUDE_MODEL }}" + + # ---- CI failure: investigate, propose a plan, DO NOT push ---- + + check-label-for-ci: + # Fires on CI workflow completion. The `workflow_run.pull_requests` array is + # populated for same-repo PRs whose head SHA matches the completed run; for + # fork PRs it is empty, which doubles as an implicit fork-guard here. + if: >- + github.event_name == 'workflow_run' && + github.event.workflow_run.conclusion == 'failure' && + github.event.workflow_run.pull_requests[0] != null + runs-on: ubuntu-latest + outputs: + pr_number: ${{ steps.lookup.outputs.pr_number }} + should_propose: ${{ steps.lookup.outputs.should_propose }} + head_ref: ${{ steps.lookup.outputs.head_ref }} + head_sha: ${{ steps.lookup.outputs.head_sha }} + author_login: ${{ steps.lookup.outputs.author_login }} + steps: + - name: Look up PR and assess state + id: lookup + uses: actions/github-script@v8 + with: + script: | + const prNumber = context.payload.workflow_run.pull_requests[0].number; + const { data: pr } = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber, + }); + const labels = pr.labels.map(l => l.name); + const hasBabysitter = labels.includes('Has Babysitter'); + const hasPending = labels.includes('Agent Plan Awaiting Approval'); + const hasApproved = labels.includes('Agent Plan Approved'); + const failedSha = context.payload.workflow_run.head_sha; + const isStale = pr.head.sha !== failedSha; + // Fork-guard: the babysitter never runs on PRs from forks. + const isFork = pr.head.repo.full_name !== `${context.repo.owner}/${context.repo.repo}`; + // Propose a new plan only if: babysitter is on, no plan is already + // in flight, the failure isn't stale, and the PR is not from a fork. + const shouldPropose = hasBabysitter && !hasPending && !hasApproved && !isStale && !isFork; + core.setOutput('pr_number', prNumber); + core.setOutput('should_propose', shouldPropose ? 'true' : 'false'); + core.setOutput('head_ref', pr.head.ref); + core.setOutput('head_sha', pr.head.sha); + core.setOutput('author_login', pr.user.login); + if (!shouldPropose) { + core.info(`Skipping investigate-and-propose: babysitter=${hasBabysitter}, pending=${hasPending}, approved=${hasApproved}, stale=${isStale}, fork=${isFork}`); + } + + investigate-and-propose: + needs: check-label-for-ci + if: needs.check-label-for-ci.outputs.should_propose == 'true' + runs-on: ubuntu-latest + concurrency: + group: babysit-fix-${{ needs.check-label-for-ci.outputs.pr_number }} + cancel-in-progress: true + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ needs.check-label-for-ci.outputs.head_ref }} + + - uses: anthropics/claude-code-action@v1 + env: + ANTHROPIC_BASE_URL: ${{ secrets.NVIDIA_INFERENCE_URL }} + CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS: "1" + DISABLE_PROMPT_CACHING: "1" + with: + anthropic_api_key: ${{ secrets.NVIDIA_INFERENCE_KEY }} + prompt: | + The CI workflow "${{ github.event.workflow_run.name }}" just failed + on PR #${{ needs.check-label-for-ci.outputs.pr_number }}. + + You are in HALF-AUTONOMOUS mode. You MUST NOT edit files, commit, + or push code in this job. Investigation and planning only. + + Instructions: + 1. Inspect the failure logs for ALL currently failing CI checks on + this PR, not just the one named above. + 2. Check `git log` for recent commits — if a prior babysitter plan + already tried the same approach and it's still failing, call + that out in your plan so the author can reconsider. + 3. Identify the root cause and draft a concrete fix plan covering: + - What's broken and why + - Which files/lines you'd change + - The minimal diff you'd apply + 4. Post a SINGLE PR comment with this exact structure: + + **CI Fix Plan** — awaiting approval from @${{ needs.check-label-for-ci.outputs.author_login }} + + + + --- + To approve, **reply with an affirmative comment that mentions `@claude`** + (e.g., `@claude go ahead`). Approval is restricted to the PR author. + Remove the `Has Babysitter` label to cancel. + + + + The `` marker MUST be the last line — later + jobs use it to find the approved plan. + 5. If you conclude the issue cannot be fixed from this PR alone, + DO NOT include the `` marker. Instead post + a comment that mentions @${{ needs.check-label-for-ci.outputs.author_login }} + describing what you found and asking for help. + claude_args: "--max-turns 10 --model ${{ vars.CLAUDE_MODEL }}" + + - name: Mark plan awaiting approval (or stop if Claude gave up) + env: + GH_TOKEN: ${{ secrets.NEMO_RELABEL_TOKEN }} + PR_NUMBER: ${{ needs.check-label-for-ci.outputs.pr_number }} + REPO: ${{ github.repository }} + run: | + # Detect whether Claude actually posted a plan comment. + PLAN_COUNT=$(gh api "repos/$REPO/issues/$PR_NUMBER/comments" \ + --jq '[.[] | select(.body | contains(""))] | length') + if [ "$PLAN_COUNT" -gt 0 ]; then + echo "Plan comment posted; adding 'Agent Plan Awaiting Approval'" + gh pr edit "$PR_NUMBER" --add-label "Agent Plan Awaiting Approval" + else + echo "No plan posted; Claude decided it couldn't fix. Disabling babysitter." + gh pr edit "$PR_NUMBER" --remove-label "Has Babysitter" + fi + + # ---- Approval Path A: affirmative comment from PR author mentioning @claude ---- + + evaluate-comment-approval: + if: >- + github.event_name == 'issue_comment' && + github.event.action == 'created' && + github.event.issue.pull_request != null && + contains(github.event.issue.labels.*.name, 'Has Babysitter') && + contains(github.event.issue.labels.*.name, 'Agent Plan Awaiting Approval') && + github.event.comment.user.type != 'Bot' && + github.event.comment.user.login == github.event.issue.user.login && + contains(github.event.comment.body, '@claude') + runs-on: ubuntu-latest + concurrency: + group: babysit-fix-${{ github.event.issue.number }} + cancel-in-progress: false + steps: + # Preflight: the commenter is the PR author (enforced by `if:`) AND must + # be an active speech_team member. Also fork-guard by fetching the PR. + - name: Verify commenter is speech_team and PR is not a fork + id: authz + uses: actions/github-script@v8 + with: + github-token: ${{ secrets.ORG_TEAM_READ_TOKEN }} + script: | + const prNumber = context.payload.issue.number; + const { data: pr } = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber, + }); + const isFork = pr.head.repo.full_name !== `${context.repo.owner}/${context.repo.repo}`; + if (isFork) { + core.info(`PR #${prNumber} is a fork; babysitter does not operate on forks.`); + core.setOutput('authorized', 'false'); + core.setOutput('reason', 'fork'); + return; + } + const username = context.payload.comment.user.login; + try { + const res = await github.rest.teams.getMembershipForUserInOrg({ + org: 'NVIDIA-NeMo', + team_slug: 'speech_team', + username, + }); + if (res.data.state !== 'active') { + core.setOutput('authorized', 'false'); + core.setOutput('reason', 'not-speech-team'); + return; + } + core.setOutput('authorized', 'true'); + } catch (e) { + core.setOutput('authorized', 'false'); + core.setOutput('reason', 'not-speech-team'); + } + + - name: Checkout for GH CLI + uses: actions/checkout@v6 + + - name: Refuse non-speech_team approval + if: steps.authz.outputs.authorized != 'true' && steps.authz.outputs.reason == 'not-speech-team' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.issue.number }} + SENDER: ${{ github.event.comment.user.login }} + run: | + gh pr comment "$PR_NUMBER" --body \ + "@${SENDER} only NVIDIA-NeMo \`speech_team\` members can approve the babysitter's plan. Ignoring this reply." + + - uses: anthropics/claude-code-action@v1 + if: steps.authz.outputs.authorized == 'true' + env: + GH_TOKEN: ${{ secrets.NEMO_RELABEL_TOKEN }} + PR_NUMBER: ${{ github.event.issue.number }} + ANTHROPIC_BASE_URL: ${{ secrets.NVIDIA_INFERENCE_URL }} + CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS: "1" + DISABLE_PROMPT_CACHING: "1" + with: + anthropic_api_key: ${{ secrets.NVIDIA_INFERENCE_KEY }} + prompt: | + Decide whether the PR author has approved the fix plan, then act. + + Context: + - PR #${{ github.event.issue.number }} has label "Agent Plan Awaiting Approval". + - The PR author (@${{ github.event.issue.user.login }}) just posted a reply. + - The approved plan is a previous PR comment containing ``. + + Steps: + 1. Read the latest `` comment on the PR for the plan. + 2. Read the PR author's reply (use `gh api repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}`). + 3. Classify the reply as exactly one of: + - APPROVE: the author clearly agrees to proceed with the plan. + - REJECT: the author clearly disagrees or wants changes. + - NEITHER: the reply is a question, side remark, or ambiguous. + 4. Take action: + - APPROVE: run exactly + `gh pr edit $PR_NUMBER --remove-label "Agent Plan Awaiting Approval" --add-label "Agent Plan Approved"` + and do nothing else. + - REJECT: post a short PR comment acknowledging the rejection + and suggesting they either remove `Has Babysitter` to cancel + or reply with a new direction. Do NOT change labels. + - NEITHER: post a short PR comment asking for an explicit + approve/reject. Do NOT change labels. + 5. Do not push any code. Do not edit files in the repository. + claude_args: "--max-turns 8 --model ${{ vars.CLAUDE_MODEL }}" + + # ---- Execute the approved plan (the only job allowed to push code) ---- + + execute-fix: + if: >- + github.event_name == 'pull_request' && + github.event.action == 'labeled' && + github.event.label.name == 'Agent Plan Approved' && + contains(github.event.pull_request.labels.*.name, 'Has Babysitter') && + github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + concurrency: + group: babysit-fix-${{ github.event.pull_request.number }} + cancel-in-progress: true + steps: + # Preflight 1: the sender (who added `Agent Plan Approved`) must be + # speech_team. Defense-in-depth against a non-member adding the label. + - name: Verify label sender is speech_team + id: authz + uses: actions/github-script@v8 + with: + github-token: ${{ secrets.ORG_TEAM_READ_TOKEN }} + script: | + const username = context.payload.sender.login; + try { + const res = await github.rest.teams.getMembershipForUserInOrg({ + org: 'NVIDIA-NeMo', + team_slug: 'speech_team', + username, + }); + core.setOutput('authorized', res.data.state === 'active' ? 'true' : 'false'); + } catch (e) { + core.setOutput('authorized', 'false'); + } + + # Preflight 2: there must exist a bot-authored `` + # comment on this PR. Prevents execution when someone adds the approved + # label manually without an investigator-posted plan. + - name: Verify a bot-authored plan comment exists + id: plan + if: steps.authz.outputs.authorized == 'true' + uses: actions/github-script@v8 + with: + script: | + const comments = await github.paginate(github.rest.issues.listComments, { + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + per_page: 100, + }); + const planComment = [...comments].reverse().find(c => + c.body.includes('') && c.user && c.user.type === 'Bot' + ); + core.setOutput('found', planComment ? 'true' : 'false'); + + - name: Checkout for GH CLI (refusal paths) + if: steps.authz.outputs.authorized != 'true' || steps.plan.outputs.found != 'true' + uses: actions/checkout@v6 + + - name: Refuse execution from non-speech_team sender + if: steps.authz.outputs.authorized != 'true' + env: + GH_TOKEN: ${{ secrets.NEMO_RELABEL_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + SENDER: ${{ github.event.sender.login }} + run: | + gh pr comment "$PR_NUMBER" --body \ + "@${SENDER} only NVIDIA-NeMo \`speech_team\` members can approve the babysitter's plan. Removing the \`Agent Plan Approved\` label." + gh pr edit "$PR_NUMBER" --remove-label "Agent Plan Approved" || true + exit 0 + + - name: Refuse execution without a plan comment + if: steps.authz.outputs.authorized == 'true' && steps.plan.outputs.found != 'true' + env: + GH_TOKEN: ${{ secrets.NEMO_RELABEL_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + run: | + gh pr comment "$PR_NUMBER" --body \ + "No approved plan found for execution. Remove \`Agent Plan Approved\` and wait for the investigator to post a plan first." + gh pr edit "$PR_NUMBER" --remove-label "Agent Plan Approved" || true + exit 0 + + - uses: actions/checkout@v6 + if: steps.authz.outputs.authorized == 'true' && steps.plan.outputs.found == 'true' + with: + ref: ${{ github.event.pull_request.head.ref }} + + - name: Record starting SHA + id: start + if: steps.authz.outputs.authorized == 'true' && steps.plan.outputs.found == 'true' + run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + + - uses: anthropics/claude-code-action@v1 + if: steps.authz.outputs.authorized == 'true' && steps.plan.outputs.found == 'true' + env: + ANTHROPIC_BASE_URL: ${{ secrets.NVIDIA_INFERENCE_URL }} + CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS: "1" + DISABLE_PROMPT_CACHING: "1" + with: + anthropic_api_key: ${{ secrets.NVIDIA_INFERENCE_KEY }} + prompt: | + The PR author has approved your previously posted fix plan. Execute it now. + + Instructions: + 1. Read the PR comment thread and find the most recent comment + containing the marker ``. That is the + approved plan. + 2. Implement exactly what the plan described. Do not expand scope. + Do not refactor code outside the plan. + 3. Commit with DCO sign-off and push to the same branch. + 4. If the plan is no longer applicable (e.g., merge conflicts, the + code has moved on, the reproduction no longer triggers the bug): + post a PR comment mentioning @${{ github.event.pull_request.user.login }} + explaining what changed and DO NOT push. + claude_args: "--max-turns 10 --model ${{ vars.CLAUDE_MODEL }}" + + - name: Re-trigger CI or stop loop + if: steps.authz.outputs.authorized == 'true' && steps.plan.outputs.found == 'true' + env: + GH_TOKEN: ${{ secrets.NEMO_RELABEL_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + ORIGINAL_SHA: ${{ steps.start.outputs.sha }} + run: | + # Clear "Agent Plan Approved" so the next iteration can re-use it. + gh pr edit "$PR_NUMBER" --remove-label "Agent Plan Approved" || true + NEW_SHA=$(gh pr view "$PR_NUMBER" --json headRefOid -q '.headRefOid') + if [ "$NEW_SHA" != "$ORIGINAL_SHA" ]; then + echo "Fix pushed (SHA changed); re-triggering CI" + gh pr edit "$PR_NUMBER" --add-label "Run CICD" + else + echo "No fix pushed; disabling babysitter" + gh pr edit "$PR_NUMBER" --remove-label "Has Babysitter" + fi + + # ---- Safety net: ping author and clear state if investigate-and-propose crashes ---- + + ping-author-on-failure: + needs: [check-label-for-ci, investigate-and-propose] + if: failure() && needs.check-label-for-ci.outputs.should_propose == 'true' + runs-on: ubuntu-latest + steps: + - name: Ping PR author + uses: actions/github-script@v8 + env: + PR_NUMBER: ${{ needs.check-label-for-ci.outputs.pr_number }} + CHECK_NAME: ${{ github.event.workflow_run.name }} + AUTHOR_LOGIN: ${{ needs.check-label-for-ci.outputs.author_login }} + with: + script: | + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: parseInt(process.env.PR_NUMBER, 10), + body: `I wasn't able to investigate the CI failure in \`${process.env.CHECK_NAME}\`. @${process.env.AUTHOR_LOGIN}, could you take a look?` + }); + + - name: Checkout for GH CLI + uses: actions/checkout@v6 + + - name: Clear all babysitter labels + env: + GH_TOKEN: ${{ secrets.NEMO_RELABEL_TOKEN }} + PR_NUMBER: ${{ needs.check-label-for-ci.outputs.pr_number }} + run: | + gh pr edit "$PR_NUMBER" --remove-label "Has Babysitter" || true + gh pr edit "$PR_NUMBER" --remove-label "Agent Plan Awaiting Approval" || true + gh pr edit "$PR_NUMBER" --remove-label "Agent Plan Approved" || true + + # ---- Deactivation: cancel in-progress fixes and clear state ---- + + deactivate: + if: >- + github.event_name == 'pull_request' && + github.event.action == 'unlabeled' && + github.event.label.name == 'Has Babysitter' + runs-on: ubuntu-latest + concurrency: + group: babysit-fix-${{ github.event.pull_request.number }} + cancel-in-progress: true + steps: + - name: Post deactivation comment + uses: actions/github-script@v8 + with: + script: | + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + body: "Babysitter deactivated for this PR." + }); + + - name: Checkout for GH CLI + uses: actions/checkout@v6 + + - name: Clear plan-state labels + env: + GH_TOKEN: ${{ secrets.NEMO_RELABEL_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + run: | + gh pr edit "$PR_NUMBER" --remove-label "Agent Plan Awaiting Approval" || true + gh pr edit "$PR_NUMBER" --remove-label "Agent Plan Approved" || true diff --git a/western_ai/canada/nemo/.github/workflows/claude-fix.yml b/western_ai/canada/nemo/.github/workflows/claude-fix.yml new file mode 100644 index 0000000000000000000000000000000000000000..28e0e340a3e226b6744014d77643d4022e981fac --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/claude-fix.yml @@ -0,0 +1,119 @@ +name: Claude Fix Issue + +on: + issue_comment: + types: [created] + +permissions: + contents: write + pull-requests: write + issues: write + id-token: write + +jobs: + authorize: + if: >- + !github.event.issue.pull_request && + contains(github.event.comment.body, '/claude fix') + runs-on: ubuntu-latest + steps: + - name: Check team membership + uses: actions/github-script@v8 + with: + github-token: ${{ secrets.ORG_TEAM_READ_TOKEN }} + script: | + const username = context.payload.comment.user.login; + try { + const res = await github.rest.teams.getMembershipForUserInOrg({ + org: 'NVIDIA-NeMo', + team_slug: 'speech_team', + username, + }); + if (res.data.state !== 'active') { + core.setFailed(`${username} is not an active member of NVIDIA Speech Team`); + } + } catch (e) { + core.setFailed(`${username} is not a member of NVIDIA Speech Team`); + } + + acknowledge: + needs: authorize + runs-on: ubuntu-latest + steps: + - name: Add eyes reaction to comment + uses: actions/github-script@v8 + with: + script: | + await github.rest.reactions.createForIssueComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: context.payload.comment.id, + content: 'eyes' + }); + + claude-fix: + needs: acknowledge + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: anthropics/claude-code-action@v1 + id: claude + env: + ANTHROPIC_BASE_URL: ${{ secrets.NVIDIA_INFERENCE_URL }} + CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS: "1" + DISABLE_PROMPT_CACHING: "1" + with: + prompt: | + You are a developer working on the NeMo repository. + Implement a focused fix for the issue based on the issue description and comments. + + Requirements: + - Always use `git commit -s` to sign off all commits (DCO requirement). + - Prioritize correctness and minimal scope; avoid unrelated refactors. + - Reproduce or reason about the failure first, then implement the smallest robust fix. + - If required, add or update tests for the changed behavior. If tests are not feasible, explain why. + - If required, update related docs or comments when behavior or usage changes. + + PR expectations: + - Create a new branch and open a pull request with your changes. + - Include a concise summary of root cause and fix based on the following PR template: + ``` + # What does this PR do ? + Add a one line overview of what this PR aims to accomplish. + + # Changelog + Add specific line by line info of high level changes in this PR. + + # Usage + Add a usage example of the changed functionality. + + Related to #${{ github.event.issue.number }} + + This PR is created by Claude. + ``` + + + anthropic_api_key: ${{ secrets.NVIDIA_INFERENCE_KEY }} + claude_args: --model "${{ vars.CLAUDE_MODEL }}" + + - name: Label PR with agent-contribution + if: steps.claude.outputs.branch_name + uses: actions/github-script@v8 + with: + script: | + const prs = await github.rest.pulls.list({ + owner: context.repo.owner, + repo: context.repo.repo, + head: `${context.repo.owner}:${process.env.BRANCH_NAME}`, + state: 'open' + }); + if (prs.data.length > 0) { + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prs.data[0].number, + labels: ['agent-contribution'] + }); + } + env: + BRANCH_NAME: ${{ steps.claude.outputs.branch_name }} diff --git a/western_ai/canada/nemo/.github/workflows/claude-review.yml b/western_ai/canada/nemo/.github/workflows/claude-review.yml new file mode 100644 index 0000000000000000000000000000000000000000..289d51df10b46beaa0c5b59e9646693e59369cbf --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/claude-review.yml @@ -0,0 +1,60 @@ +name: Claude Code Review + +on: + issue_comment: + types: [created] + +permissions: + contents: read + pull-requests: write + issues: write + id-token: write + +jobs: + acknowledge: + if: >- + github.event.issue.pull_request && + contains(github.event.comment.body, '/claude review') + runs-on: ubuntu-latest + steps: + - name: Add eyes reaction to comment + uses: actions/github-script@v8 + with: + script: | + await github.rest.reactions.createForIssueComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: context.payload.comment.id, + content: 'eyes' + }); + + claude-review: + needs: acknowledge + uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/_claude_review.yml@v1.7.0 + with: + model: ${{ vars.CLAUDE_MODEL }} + prompt: | + You are doing a light code review. Keep it concise and actionable. + + Focus ONLY on: + - Critical bugs or logic errors + - Typos in code, comments, or strings + - Missing or insufficient test coverage for changed code + - Outdated or inaccurate documentation affected by the changes + + Do NOT comment on: + - Style preferences or formatting + - Minor naming suggestions + - Architectural opinions or refactoring ideas + - Performance unless there is a clear, measurable issue + + Provide feedback using inline comments for specific code suggestions. + Use top-level comments for general observations. + + IMPORTANT: Do NOT approve the pull request. Only leave comments. + + It's perfectly acceptable to not have anything to comment on. + If you do not have anything to comment on, post "LGTM". + secrets: + NVIDIA_INFERENCE_URL: ${{ secrets.NVIDIA_INFERENCE_URL }} + NVIDIA_INFERENCE_KEY: ${{ secrets.NVIDIA_INFERENCE_KEY }} \ No newline at end of file diff --git a/western_ai/canada/nemo/.github/workflows/close-inactive-issue-pr.yml b/western_ai/canada/nemo/.github/workflows/close-inactive-issue-pr.yml new file mode 100644 index 0000000000000000000000000000000000000000..75658101311e8598cd7d330475912f5726cebc37 --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/close-inactive-issue-pr.yml @@ -0,0 +1,25 @@ +name: Stale-Close-Inactive-Issues-PRs +on: + schedule: + - cron: "30 1 * * *" + +jobs: + close-issues: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/stale@v6 + with: + operations-per-run: 100 + days-before-issue-stale: 30 + days-before-issue-close: 7 + stale-issue-label: "stale" + stale-issue-message: "This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days." + close-issue-message: "This issue was closed because it has been inactive for 7 days since being marked as stale." + days-before-pr-stale: 14 + days-before-pr-close: 7 + stale-pr-message: "This PR is stale because it has been open for 14 days with no activity. Remove stale label or comment or update or this will be closed in 7 days." + close-pr-message: "This PR was closed because it has been inactive for 7 days since being marked as stale." + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/western_ai/canada/nemo/.github/workflows/code-formatting.yml b/western_ai/canada/nemo/.github/workflows/code-formatting.yml new file mode 100644 index 0000000000000000000000000000000000000000..e6e372bd76b8383ea7374fe0f234188357723397 --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/code-formatting.yml @@ -0,0 +1,50 @@ +name: Isort and Black Formatting Check +# Check that changed files are formatted with black and isort. +# Fails if any file needs reformatting — run `pre-commit run --all-files` locally to fix. + +on: + pull_request: + paths: + - "**.py" + types: [opened, synchronize, reopened] + +defaults: + run: + shell: bash -x -e -u -o pipefail {0} + +jobs: + check_isort_and_black: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout branch + uses: actions/checkout@v6 + + - name: Get changed files + id: changed-files + uses: step-security/changed-files@v45.0.1 + with: + files: | + **.py + + - name: Setup Python env + uses: actions/setup-python@v6 + with: + python-version: "3.10" + + - name: black + uses: psf/black@stable + if: ${{ steps.changed-files.outputs.any_changed == 'true' }} + with: + options: "--check --verbose" + # check only changed files (pass explicitly the files) + src: "${{ steps.changed-files.outputs.all_changed_files }}" + version: "~= 24.3" + + - name: isort + uses: isort/isort-action@v1 + if: ${{ steps.changed-files.outputs.any_changed == 'true' }} + with: + isort-version: "5.13.2" + configuration: "--check-only --diff" diff --git a/western_ai/canada/nemo/.github/workflows/code-init-file-checker.yml b/western_ai/canada/nemo/.github/workflows/code-init-file-checker.yml new file mode 100644 index 0000000000000000000000000000000000000000..ed2d6c3b661d9b5c20508a8018a41a72047ce282 --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/code-init-file-checker.yml @@ -0,0 +1,23 @@ +name: Check __init__ files + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + check-init-files: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.11" + + - name: Install init-file-checker + run: pip install init-file-checker + + - name: Run init-file-checker + run: init-file-checker nemo/ diff --git a/western_ai/canada/nemo/.github/workflows/code-linting.yml b/western_ai/canada/nemo/.github/workflows/code-linting.yml new file mode 100644 index 0000000000000000000000000000000000000000..4ddadc944232b14492add71b869424544227720a --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/code-linting.yml @@ -0,0 +1,178 @@ +name: PyLint and flake8 linting + +on: + pull_request: + types: [opened, synchronize, reopened, labeled, unlabeled] + workflow_call: + inputs: + skip_docs: + required: false + default: 'false' + type: string + skip_linting: + required: false + default: 'false' + type: string + +jobs: + linting: + name: "Domain: ${{ matrix.domain }}" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + domain: [speech, other] + env: + DOMAIN: ${{ matrix.domain }} + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Get PR info + id: get-pr-info + if: startsWith(github.ref, 'refs/heads/pull-request/') + uses: nv-gha-runners/get-pr-info@main + + - name: Select filter + id: filter + run: | + if [[ "$DOMAIN" == "speech" ]]; then + FILTER=$(jq -crn '[ + "nemo/collections/common/data/lhotse/*.py", + "nemo/collections/asr/**/*.py", + "nemo/collections/tts/**/*.py", + "nemo/collections/audio/**/*.py", + "nemo/collections/multimodal/speech_llm/**/*.py", + "nemo/collections/speechlm/**/*.py", + "nemo/collections/speechlm2/**/*.py" + ] | join(",")') + + else + FILTER=$(jq -crn '[ + "nemo/**/*.py", + "!nemo/collections/common/data/lhotse/*.py", + "!nemo/collections/asr/**/*.py", + "!nemo/collections/tts/**/*.py", + "!nemo/collections/audio/**/*.py", + "!nemo/collections/multimodal/speech_llm/**/*.py", + "!nemo/collections/speechlm/**/*.py", + "!nemo/collections/speechlm2/**/*.py", + "!nemo/export/**/*.py" + ] | join(",")') + fi + + echo "main=$FILTER" | tee -a "$GITHUB_OUTPUT" + + - name: Get changed files + id: changed-files + uses: step-security/changed-files@v45.0.1 + with: + sha: ${{ github.sha }} + base_sha: ${{ fromJSON(steps.get-pr-info.outputs.pr-info || '{}').base.sha || github.event.pull_request.base.sha }} + files: ${{ steps.filter.outputs.main }} + files_separator: "," + separator: " " + + - name: Run PyLint + id: pylint + env: + CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + SKIP_DOCS: ${{ inputs.skip_docs == 'true' || contains(github.event.pull_request.labels.*.name, 'skip-docs') }} + SKIP_LINTING: ${{ inputs.skip_linting == 'true' || contains(github.event.pull_request.labels.*.name, 'skip-linting') }} + run: | + if [[ -z "$CHANGED_FILES" ]]; then + echo Nothing to lint. + echo "exit-code=0" | tee -a "$GITHUB_OUTPUT" + exit 0 + fi + + if [[ $SKIP_DOCS == true ]]; then + ADDITIONAL_PYLINT_ARGS="--disable=C0115,C0116" + else + ADDITIONAL_PYLINT_ARGS="" + fi + + if [[ $SKIP_LINTING == true ]]; then + ADDITIONAL_PYLINT_ARGS="--exit-zero" + fi + + pip install pylint + set +e + pylint $ADDITIONAL_PYLINT_ARGS --output "pylintrc.$DOMAIN.txt" --rcfile ".pylintrc.$DOMAIN" ${CHANGED_FILES[@]} + echo "exit-code=$?" | tee -a "$GITHUB_OUTPUT" + + - name: Run flake8 + id: flake8 + env: + CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + SKIP_LINTING: ${{ inputs.skip_linting == 'true' || contains(github.event.pull_request.labels.*.name, 'skip-linting') }} + run: | + if [[ -z "$CHANGED_FILES" ]]; then + echo Nothing to lint. + echo "exit-code=0" | tee -a "$GITHUB_OUTPUT" + exit 0 + fi + + if [[ $SKIP_LINTING == true ]]; then + ADDITIONAL_FLAKE8_ARGS="--exit-zero" + else + ADDITIONAL_FLAKE8_ARGS="" + fi + + pip install flake8 + set +e + flake8 $ADDITIONAL_FLAKE8_ARGS --output "flake8.$DOMAIN.txt" --config ".flake8.$DOMAIN" ${CHANGED_FILES[@]} + echo "exit-code=$?" | tee -a "$GITHUB_OUTPUT" + + - name: Summary + env: + PYLINT: ${{ steps.pylint.outputs.exit-code == 0 }} + FLAKE8: ${{ steps.flake8.outputs.exit-code == 0 }} + run: | + + if [[ "$PYLINT" != "true" ]]; then + echo "Pylint output:" | tee -a $GITHUB_STEP_SUMMARY + + echo '```' | tee -a $GITHUB_STEP_SUMMARY + cat pylintrc.$DOMAIN.txt | tee -a $GITHUB_STEP_SUMMARY + echo '```' | tee -a $GITHUB_STEP_SUMMARY + fi + + if [[ "$FLAKE8" != "true" ]]; then + echo "Flake8 output:" | tee -a $GITHUB_STEP_SUMMARY + + echo '```' | tee -a $GITHUB_STEP_SUMMARY + cat flake8.$DOMAIN.txt | tee -a $GITHUB_STEP_SUMMARY + echo '```' | tee -a $GITHUB_STEP_SUMMARY + fi + + if [[ "$PYLINT" != "true" || "$FLAKE8" != "true" ]]; then + echo "The following directories got scanned:" | tee -a $GITHUB_STEP_SUMMARY + + echo '```' | tee -a $GITHUB_STEP_SUMMARY + echo ${{ steps.filter.outputs.main }} | tee -a $GITHUB_STEP_SUMMARY + echo '```' | tee -a $GITHUB_STEP_SUMMARY + + exit 1 + fi + + Nemo_Linting_Test: + needs: linting + runs-on: ubuntu-latest + if: always() + steps: + - name: Main + env: + RESULTS: ${{ toJson(needs.linting) }} + run: | + RESULT=$(echo "$RESULTS" | jq -r '.result') + + if [[ "$RESULT" == "success" ]]; then + echo "All passed." + exit 0 + else + echo "Some linting domains failed." + exit 1 + fi diff --git a/western_ai/canada/nemo/.github/workflows/codeql.yml b/western_ai/canada/nemo/.github/workflows/codeql.yml new file mode 100644 index 0000000000000000000000000000000000000000..072fd981ecb30e68b4c64987b6586fac445992b1 --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/codeql.yml @@ -0,0 +1,75 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "main", "[rv][0-9]*", "gh-pages-src" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "main" ] + schedule: + - cron: '19 1 * * 4' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'python' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + queries: security-and-quality # security-extended, + config-file: ./.github/workflows/config/codeql.yml + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" diff --git a/western_ai/canada/nemo/.github/workflows/community-bot.yml b/western_ai/canada/nemo/.github/workflows/community-bot.yml new file mode 100644 index 0000000000000000000000000000000000000000..4442bc01514b2449a864925f3dbb7642b4ded96b --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/community-bot.yml @@ -0,0 +1,15 @@ +name: Community Bot + +on: + issues: + types: [opened, edited, reopened, closed, deleted] + issue_comment: + types: [created, edited, deleted] + +jobs: + community-bot: + uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/_community_bot.yml@v0.62.0 + with: + community_project_id: ${{ vars.COMMUNITY_PROJECT_ID }} + secrets: + GH_TOKEN: ${{ secrets.PAT }} diff --git a/western_ai/canada/nemo/.github/workflows/config/changelog-config.json b/western_ai/canada/nemo/.github/workflows/config/changelog-config.json new file mode 100644 index 0000000000000000000000000000000000000000..7211234db590fd0ab9ffbb9da9dc1732101cdc05 --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/config/changelog-config.json @@ -0,0 +1,205 @@ +{ + "categories": [ + { + "title": "## ASR\n\n
Changelog", + "labels": [ + "asr" + ], + "exclude_labels": [ + "cherry-pick" + ] + }, + { + "title": "
\n\n## TTS\n\n
Changelog", + "labels": [ + "tts" + ], + "exclude_labels": [ + "cherry-pick" + ] + }, + { + "title": "
\n\n## NLP / NMT\n\n
Changelog", + "labels": [ + "nlp", + "nmt", + "megatron" + ], + "exclude_labels": [ + "cherry-pick" + ] + }, + { + "title": "
\n\n## Text Normalization / Inverse Text Normalization\n\n
Changelog", + "labels": [ + "tn", + "itn" + ], + "exclude_labels": [ + "cherry-pick" + ] + }, + { + "title": "
\n\n## NeMo Tools\n\n
Changelog", + "labels": [ + "tools" + ], + "exclude_labels": [ + "cherry-pick" + ] + }, + { + "title": "
\n\n## Export\n\n
Changelog", + "labels": [ + "export" + ], + "exclude_labels": [ + "cherry-pick" + ] + }, + { + "title": "
\n\n## Documentation\n\n
Changelog", + "labels": [ + "docs" + ], + "exclude_labels": [ + "cherry-pick" + ] + }, + { + "title": "
\n\n## Bugfixes\n\n
Changelog", + "labels": [ + "bug" + ], + "exclude_labels": [ + "cherry-pick" + ] + }, + { + "title": "
\n\n## Cherrypick\n\n
Changelog", + "labels": [ + "cherry-pick" + ], + "exclude_labels": [ + "cherry-pick" + ] + } + ], + "ignore_labels": [ + "ignore" + ], + "sort": "ASC", + "template": "\n${{CHANGELOG}}
\n\n## Uncategorized:\n\n
Changelog\n\n${{UNCATEGORIZED}}\n
\n", + "pr_template": "- ${{TITLE}} by @${{AUTHOR}} :: PR: #${{NUMBER}}", + "empty_template": "${{OWNER}}\n${{REPO}}\n${{FROM_TAG}}\n${{TO_TAG}}", + "label_extractor": [ + { + "pattern": "(.*tts.*)|(.*g2p.*)", + "target": "tts", + "flags": "gimu", + "on_property": [ + "title", + "body" + ] + }, + { + "pattern": "(.*asr.*)|(.*ctc.*)|(.*rnnt.*)|(.*transducer.*)|(.*dali.*)|(.*k2.*)", + "target": "asr", + "flags": "gimu", + "on_property": [ + "title", + "body" + ] + }, + { + "pattern": "(.*nlp.*)|(.*punctuation.*)|(.*capitalization.*)|(.*entity.*)|(.*glue.*)|(.*entity.*)|(.*retrieval.*)|(.*entity.*)|(.*intent.*)|(.*slot.*)|(.*entity.*)|(.*language.*)|(.*qa.*)|(.*token class.*)|(.*text class.*)", + "target": "nlp", + "flags": "gimu", + "on_property": [ + "title", + "body" + ] + }, + { + "pattern": "(.*nmt.*)|(.*bignlp.*)|(.*megatron.*)|(.*machine.*)|(.*translation.*)|(.*gpt.*)", + "target": "nmt", + "flags": "gimu", + "on_property": [ + "title", + "body" + ] + }, + { + "pattern": "(.*tn.*)|(.*itn.*)|(.*text norm.*)", + "target": "tn", + "flags": "gimu", + "on_property": [ + "title", + "body" + ] + }, + { + "pattern": "(.*sde.*)|(.*ctc segment.*)", + "target": "tools", + "flags": "gimu", + "on_property": [ + "title", + "body" + ] + }, + { + "pattern": "(.*trt.*)|(.*onnx.*)|(.*export.*)", + "target": "export", + "flags": "gimu", + "on_property": [ + "title", + "body" + ] + }, + { + "pattern": "(.*\\[x\\] Documentation.*)", + "target": "docs", + "flags": "gmu", + "on_property": [ + "title", + "body" + ] + }, + { + "pattern": "(.*\\[x\\] Bugfix.*)|(.*patch.*)", + "target": "bug", + "flags": "gmu", + "on_property": [ + "title", + "body" + ] + }, + { + "pattern": "(.*cherry-pick.*)|(.*cherrypick.*)", + "target": "cherrypick", + "flags": "gimu", + "on_property": [ + "title", + "body" + ] + } + ], + "duplicate_filter": { + "pattern": ".+", + "on_property": "title", + "method": "match" + }, + "transformers": [ + { + "pattern": "^cp:\\s*`(.+?)`\\s*into\\s*\\S+", + "target": "$1" + } + ], + "max_tags_to_fetch": 100, + "max_pull_requests": 500, + "max_back_track_time_days": 365, + "exclude_merge_branches": [], + "tag_resolver": { + "method": "semver" + } +} \ No newline at end of file diff --git a/western_ai/canada/nemo/.github/workflows/config/codeql.yml b/western_ai/canada/nemo/.github/workflows/config/codeql.yml new file mode 100644 index 0000000000000000000000000000000000000000..652c15d77228c5604a82dcd225d1073a4c4cfe16 --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/config/codeql.yml @@ -0,0 +1,9 @@ +name: "CodeQL config" + +paths: + - nemo/ + - tests/ + - tools/ + - scripts/ + - examples/ + - .github/ diff --git a/western_ai/canada/nemo/.github/workflows/copyright-check.yml b/western_ai/canada/nemo/.github/workflows/copyright-check.yml new file mode 100644 index 0000000000000000000000000000000000000000..f68516dc7deb05f51e41c9cac7edb5a2cba60970 --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/copyright-check.yml @@ -0,0 +1,22 @@ +# Copyright (c) 2020-2021, NVIDIA CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Copyright check + +on: + pull_request: + +jobs: + copyright-check: + uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/_copyright_check.yml@v0.2.0 diff --git a/western_ai/canada/nemo/.github/workflows/install-test.yml b/western_ai/canada/nemo/.github/workflows/install-test.yml new file mode 100644 index 0000000000000000000000000000000000000000..2db74c7e88a9f6736f638c91038e47d886f18381 --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/install-test.yml @@ -0,0 +1,283 @@ +name: CI-Install-Check + +on: + pull_request: + paths: + - "**" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test-installs-macos: + name: ${{ matrix.os }}-py${{ matrix.python }}-${{ matrix.installer }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macos-latest] + python: ["3.10", "3.11", "3.12"] + installer: ["pip-install", "nemo-install"] + steps: + - name: Checkout repo + uses: actions/checkout@v6 + + - name: Check disk space before cleanup + run: df -h + + - name: Free up disk space + run: | + # Remove unnecessary files on macOS + sudo rm -rf /usr/local/lib/android || true + sudo rm -rf /usr/local/.ghcup || true + sudo rm -rf /usr/local/lib/node_modules || true + brew cleanup || true + # Clear pip cache + pip cache purge || true + + - name: Check disk space after cleanup + run: df -h + + - uses: actions/setup-python@v6 + with: + python-version: "${{ matrix.python }}" + + - name: Install NeMo + env: + INSTALLER: ${{ matrix.installer }} + NEMO_TAG: ${{ github.sha }} + NEMO_REPO: ${{ github.server_url }}/${{ github.repository }} + run: | + if [[ "$INSTALLER" == "pip-install" ]]; then + pip install --no-cache-dir -U pip + pip install --no-cache-dir ".[all]" + else + export NEMO_TAG + export NEMO_REPO + export INSTALL_DIR=$(pwd) + + pip install --no-cache-dir ".[all]" + fi + + - name: Check disk space after installation + run: df -h + + - name: Run import checks + run: | + # Run import checks + for collection in "asr" "tts" "lightning" "core"; do + python tests/core_ptl/check_imports.py --domain "$collection" + done + + test-installs-linux-amd: + name: ubuntu-22.04-amd-py${{ matrix.python }}-${{ matrix.installer }} + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + python: ["3.10", "3.11", "3.12"] + installer: ["pip-install", "nemo-install"] + steps: + - name: Checkout repo + uses: actions/checkout@v6 + + - name: Check disk space before cleanup + run: df -h + + - name: Free up disk space + run: | + # Remove unnecessary packages and files on Ubuntu + sudo apt-get clean + sudo rm -rf /usr/local/lib/android || true + sudo rm -rf /opt/ghc || true + sudo rm -rf /usr/local/.ghcup || true + sudo rm -rf /usr/share/dotnet || true + sudo rm -rf /opt/az || true + # Clear pip and npm caches + pip cache purge || true + sudo npm cache clean --force || true + + - name: Check disk space after cleanup + run: df -h + + - name: Install Python + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python }} + + - name: Install NeMo + env: + INSTALLER: ${{ matrix.installer }} + run: | + if [ "$INSTALLER" = "pip-install" ]; then + pip install --no-cache-dir --upgrade pip + pip install --no-cache-dir ".[all]" + else + export INSTALL_DIR=$(pwd) + pip install --no-cache-dir ".[all]" + fi + + - name: Check disk space after installation + run: df -h + + - name: Run import checks + run: | + # Run import checks + for collection in "asr" "tts" "lightning" "core"; do + python tests/core_ptl/check_imports.py --domain "$collection" + done + + test-asr-install-linux-amd: + name: ubuntu-22.04-amd-py${{ matrix.python }}-asr + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + python: ["3.10", "3.11", "3.12"] + steps: + - name: Checkout repo + uses: actions/checkout@v6 + + - name: Check disk space before cleanup + run: df -h + + - name: Free up disk space + run: | + # Remove unnecessary packages and files on Ubuntu + sudo apt-get clean + sudo rm -rf /usr/local/lib/android || true + sudo rm -rf /opt/ghc || true + sudo rm -rf /usr/local/.ghcup || true + sudo rm -rf /usr/share/dotnet || true + sudo rm -rf /opt/az || true + # Clear pip and npm caches + pip cache purge || true + sudo npm cache clean --force || true + + - name: Check disk space after cleanup + run: df -h + + - name: Install Python + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python }} + + - name: Install NeMo + run: | + pip install --no-cache-dir --upgrade pip + pip install --no-cache-dir ".[asr]" + + - name: Check disk space after installation + run: df -h + + - name: Run import checks + run: | + # Run import checks + python tests/core_ptl/check_imports.py --domain asr + + test-installs-linux-arm: + name: ubuntu-22.04-arm-py${{ matrix.python }}-${{ matrix.installer }} + runs-on: ubuntu-22.04-arm + strategy: + fail-fast: false + matrix: + python: ["3.10", "3.11", "3.12"] + installer: ["pip-install", "nemo-install"] + steps: + - name: Checkout repo + uses: actions/checkout@v6 + + - name: Check disk space before cleanup + run: df -h + + - name: Free up disk space + run: | + # Remove unnecessary packages and files on Ubuntu ARM + sudo apt-get clean + sudo rm -rf /usr/local/lib/android || true + sudo rm -rf /opt/ghc || true + sudo rm -rf /usr/local/.ghcup || true + sudo rm -rf /usr/share/dotnet || true + sudo rm -rf /opt/az || true + # Clear pip and npm caches + pip cache purge || true + sudo npm cache clean --force || true + + - name: Check disk space after cleanup + run: df -h + + - name: Install Python + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python }} + + - name: Install NeMo + env: + INSTALLER: ${{ matrix.installer }} + run: | + if [ "$INSTALLER" = "pip-install" ]; then + pip install --no-cache-dir --upgrade pip + pip install --no-cache-dir ".[all]" + else + export INSTALL_DIR=$(pwd) + pip install --no-cache-dir ".[all]" + fi + + - name: Check disk space after installation + run: df -h + + - name: Run import checks + run: | + # Run import checks + for collection in "asr" "tts" "lightning" "core"; do + python tests/core_ptl/check_imports.py --domain "$collection" + done + + test-asr-installs-linux-arm: + name: ubuntu-22.04-arm-py${{ matrix.python }}-asr + runs-on: ubuntu-22.04-arm + strategy: + fail-fast: false + matrix: + python: ["3.10", "3.11", "3.12"] + steps: + - name: Checkout repo + uses: actions/checkout@v6 + + - name: Check disk space before cleanup + run: df -h + + - name: Free up disk space + run: | + # Remove unnecessary packages and files on Ubuntu ARM + sudo apt-get clean + sudo rm -rf /usr/local/lib/android || true + sudo rm -rf /opt/ghc || true + sudo rm -rf /usr/local/.ghcup || true + sudo rm -rf /usr/share/dotnet || true + sudo rm -rf /opt/az || true + # Clear pip and npm caches + pip cache purge || true + sudo npm cache clean --force || true + + - name: Check disk space after cleanup + run: df -h + + - name: Install Python + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python }} + + - name: Install NeMo + run: | + pip install --no-cache-dir --upgrade pip + pip install --no-cache-dir ".[asr]" + + - name: Check disk space after installation + run: df -h + + - name: Run import checks + run: | + # Run import checks + python tests/core_ptl/check_imports.py --domain asr diff --git a/western_ai/canada/nemo/.github/workflows/labeler.yml b/western_ai/canada/nemo/.github/workflows/labeler.yml new file mode 100644 index 0000000000000000000000000000000000000000..51dced0ed741d3826b67ad34857e5015d9b2bee4 --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/labeler.yml @@ -0,0 +1,14 @@ +name: "Pull Request Labeler" +on: +- pull_request_target + +jobs: + triage: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v4 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/western_ai/canada/nemo/.github/workflows/mcore-tag-bump-bot.yml b/western_ai/canada/nemo/.github/workflows/mcore-tag-bump-bot.yml new file mode 100644 index 0000000000000000000000000000000000000000..2067597111253994a7424fec98fad09beedcb0b9 --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/mcore-tag-bump-bot.yml @@ -0,0 +1,62 @@ +# Regularly updates the CI container +name: Megatron Tag Bump Bot +on: + workflow_dispatch: + schedule: + - cron: 0 0 * * * + +jobs: + get-release-branch-names: + runs-on: ubuntu-latest + outputs: + mcore: ${{ steps.get-branch.outputs.mcore_release_branch }} + nemo: ${{ steps.get-branch.outputs.nemo_release_branch }} + steps: + - name: Get release branch names + id: get-branch + run: | + latest_branch=$(git ls-remote --heads https://github.com/NVIDIA/Megatron-LM.git 'refs/heads/core_r*' | + grep -o 'core_r[0-9]\+\.[0-9]\+\.[0-9]\+' | + sort -V | + tail -n1) + echo "mcore_release_branch=$latest_branch" >> $GITHUB_OUTPUT + + latest_branch=$(git ls-remote --heads https://github.com/NVIDIA/NeMo.git 'refs/heads/r*' | + grep -o 'r[0-9]\+\.[0-9]\+\.[0-9]\+' | + sort -V | + tail -n1) + echo "nemo_release_branch=$latest_branch" >> $GITHUB_OUTPUT + + bump-tags: + needs: [get-release-branch-names] + strategy: + fail-fast: false + matrix: + include: + - nemo-target-branch: ${{ needs.get-release-branch-names.outputs.nemo }} + mcore-target-branch: ${{ needs.get-release-branch-names.outputs.mcore }} + - nemo-target-branch: main + mcore-target-branch: main + uses: ./.github/workflows/_bump_mcore_tag.yml + with: + nemo-target-branch: ${{ matrix.nemo-target-branch }} + mcore-target-branch: ${{ matrix.mcore-target-branch }} + secrets: + PAT: ${{ secrets.PAT }} + + notify: + if: failure() + runs-on: ubuntu-latest + needs: [bump-tags] + steps: + - name: Notify + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + SLACK_WEBHOOK_ADMIN: + GITHUB_RUN_ID: ${{ github.run_id }} + GITHUB_REPOSITORY: ${{ github.repository }} + run: | + curl -X POST \ + -H 'Content-type: application/json' \ + --data "{\"text\":\":robot_joy: failed. Please fix manually.\n\ncc ${SLACK_WEBHOOK_ADMIN}\"}" \ + $SLACK_WEBHOOK diff --git a/western_ai/canada/nemo/.github/workflows/monitor-single-vm.yml b/western_ai/canada/nemo/.github/workflows/monitor-single-vm.yml new file mode 100644 index 0000000000000000000000000000000000000000..e9c35d75f986a436a1ccc29c1005e6c104f40f87 --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/monitor-single-vm.yml @@ -0,0 +1,54 @@ +name: ~shut down a single VM + +on: + workflow_call: + inputs: + vm: + type: string + description: Name of VM + required: true + n_gpus: + type: string + description: Number of GPUs this VM has + required: true + +jobs: + check-status-and-maybe-shutdown: + environment: main + runs-on: ${{ inputs.vm }} + outputs: + status: ${{ steps.status.outputs.main }} + steps: + - name: Check status + id: status + run: | + docker run --rm --runtime=nvidia --gpus ${{ inputs.n_gpus }} ubuntu nvidia-smi + + NUM_GPUS=$(nvidia-smi --query-gpu=name --format=csv,noheader | wc -l) + + if [[ $NUM_GPUS -ne ${{ inputs.n_gpus }} ]]; then + echo "Issues with GPU detected, will take this runner offline." + echo "main=degraded" >> "$GITHUB_OUTPUT" + else + echo "main=healthy" >> "$GITHUB_OUTPUT" + fi + + - name: Send Slack message & Disconnect runner from GitHub + if: ${{ steps.status.outputs.main == 'degraded' || failure() }} + run: | + MESSAGE='{ + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": ":alert: VM bot 🤖: Hey : VM `${{ inputs.vm }}` is having not the best day of their life, maybe bring them an apple or so." + } + } + ] + }' + + curl -X POST -H "Content-type: application/json" --data "$MESSAGE" ${{ secrets.SLACK_WEBHOOK }} + + cd /home/azureuser/actions-runner + echo ${{ secrets.VM_KEY }} | sudo -S ./svc.sh stop diff --git a/western_ai/canada/nemo/.github/workflows/monitor-vms.yml b/western_ai/canada/nemo/.github/workflows/monitor-vms.yml new file mode 100644 index 0000000000000000000000000000000000000000..7cfc7c63935b085510a0126f3f3d5e2b0fc9fb55 --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/monitor-vms.yml @@ -0,0 +1,54 @@ +# Regularly updates the CI container +name: Reboots VMs in a controlled way +on: + schedule: + - cron: 0/15 * * * * + workflow_dispatch: + +jobs: + pre-flight: + runs-on: ubuntu-latest + if: github.repository_owner == 'NVIDIA' + outputs: + list-of-vms: ${{ steps.main.outputs.main }} + environment: main + steps: + - name: Get list of VMs + id: main + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + run: | + RUNNERS=$(curl -L \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/NVIDIA/NeMo/actions/runners) + + MATRIX=$(echo $RUNNERS \ + | jq -c '[ + .runners[] + | select(.status == "online") + | select(.name | contains("cpu") | not) + | { + "vm": .name, + "n_gpus": [ + .labels[] + | select(.name | endswith("gpu")) | .name + ][0][:1] + } + ] + ' + ) + echo main=$MATRIX | tee -a "$GITHUB_OUTPUT" + + maintenance: + needs: pre-flight + strategy: + fail-fast: false + matrix: + include: ${{ fromJSON(needs.pre-flight.outputs.list-of-vms )}} + uses: ./.github/workflows/monitor-single-vm.yml + with: + vm: ${{ matrix.vm }} + n_gpus: ${{ matrix.n_gpus }} + secrets: inherit # pragma: allowlist secret diff --git a/western_ai/canada/nemo/.github/workflows/release-docs.yml b/western_ai/canada/nemo/.github/workflows/release-docs.yml new file mode 100644 index 0000000000000000000000000000000000000000..2b5fe3166b21cea02e16f070ec768d74d276d8d4 --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/release-docs.yml @@ -0,0 +1,123 @@ +# Copyright (c) 2026, NVIDIA CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: Release docs +on: + workflow_dispatch: + inputs: + dry-run: + description: Whether to run the workflow in dry-run mode + required: true + type: boolean + default: true + publish-as-latest: + description: Publish as Latest stable version. + required: false + type: boolean + default: true + docs-version-override: + description: Docs version if commit is not tagged + required: false + type: string + default: "" + update-version-picker: + description: Update version picker. + required: false + type: boolean + default: true + notify-emails: + description: Email addresses to send the notification to. Format as "me@me.com,you@you.com". + required: false + type: string + github-ref: + description: Github ref to checkout + required: false + type: string + default: "" + workflow_call: + inputs: + dry-run: + description: Whether to run the workflow in dry-run mode + required: false + type: boolean + default: true + publish-as-latest: + description: Publish as Latest stable version. + required: false + type: boolean + default: true + docs-version-override: + description: Docs version if commit is not tagged + required: false + type: string + default: "" + update-version-picker: + description: Update version picker. + required: false + type: boolean + default: true + notify-emails: + description: Email addresses to send the notification to. Format as "me@me.com,you@you.com". + required: false + type: string + github-ref: + description: Github ref to checkout + required: false + type: string + default: "" + +jobs: + build-docs: + uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/_build_docs.yml@v0.83.0 + with: + ref: ${{ inputs.github-ref }} + docs-directory: docs/source + sync-all: true + no-extras: "--no-extra cu12 --no-extra compiled --no-extra compiled-a100" + + publish-docs: + runs-on: ubuntu-latest + needs: [build-docs] + steps: + - uses: actions/checkout@v6 + with: + repository: NVIDIA-NeMo/FW-CI-templates + ref: v0.74.0 + path: FW-CI-templates + + - uses: ./FW-CI-templates/.github/actions/publish-docs + # This workflow runs either on main, or on a version tag. Any other git ref will lead + # to an error. + # If its on main, it will publish to "latest" directory in Akamai. + # If its on a versioned tag, it will extract the version number from the tag (strip `v` prefix) + # and publish to the versioned directory in Akamai. + with: + dry-run: ${{ inputs.dry-run }} + artifacts-name: docs-html + artifacts-path: _build/html + emails-csv: ${{ inputs.notify-emails && format('{0},{1}', vars.docs_release_emails, inputs.notify-emails) || vars.docs_release_emails }} + overwrite-latest-on-tag: ${{ inputs.publish-as-latest }} + docs-version-override: ${{ inputs.docs-version-override }} + update-version-picker: ${{ inputs.update-version-picker }} + run-on-version-tag-only: ${{ github.ref_name != 'main' }} + request-name: nemo-speech-publish-docs-${{ github.run_id }} + aws-region: ${{ vars.DOCS_AWS_REGION }} + aws-role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + akamai-host: ${{ secrets.AKAMAI_HOST }} + akamai-client-token: ${{ secrets.AKAMAI_CLIENT_TOKEN }} + akamai-client-secret: ${{ secrets.AKAMAI_CLIENT_SECRET }} + akamai-access-token: ${{ secrets.AKAMAI_ACCESS_TOKEN }} + s3-target-root: ${{ secrets.S3_BUCKET_NAME }} + s3-target-path: nemo/speech diff --git a/western_ai/canada/nemo/.github/workflows/release-freeze.yml b/western_ai/canada/nemo/.github/workflows/release-freeze.yml new file mode 100644 index 0000000000000000000000000000000000000000..5d5c1ce8c591bd63264235107baf237178dc40bc --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/release-freeze.yml @@ -0,0 +1,80 @@ +name: "Code freeze" + +on: + workflow_dispatch: + inputs: + type_of_release: + type: choice + description: Type of release + options: + - major + - minor + freeze-commit: + type: string + description: Commit SHA to use for cut-off + required: false + default: main + mcore_version: + description: "Version of MCore to use (must be a valid git ref)" + required: true + type: string + dry-run: + type: boolean + description: Dry-run of code-freeze + required: false + default: true + +jobs: + code-freeze: + uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/_code_freeze.yml@v0.86.0 + with: + library-name: NeMo-Toolkit + python-package: nemo + release-type: ${{ inputs.type_of_release }} + freeze-commit: ${{ inputs.freeze-commit }} + dry-run: ${{ inputs.dry-run }} + use-pat: true + secrets: + SLACK_WEBHOOK: ${{ secrets.SLACK_RELEASE_ENDPOINT }} + SLACK_WEBHOOK_ADMIN: ${{ secrets.SLACK_WEBHOOK_ADMIN }} + PAT: ${{ secrets.PAT }} + + freeze-tags: + runs-on: ubuntu-latest + needs: [code-freeze] + environment: main + steps: + - name: Checkout repository + uses: actions/checkout@v6 + with: + path: ${{ github.run_id }} + token: ${{ secrets.PAT }} + fetch-depth: 0 + fetch-tags: true + ref: ${{ inputs.dry-run == true && inputs.freeze-commit || needs.code-freeze.outputs.release-branch }} + + - name: Pin branch name in Notebooks + run: | + cd ${{ github.run_id }} + find tutorials -type f -name "*.ipynb" -exec sed -i "s/BRANCH = 'main'/BRANCH = '${{ needs.code-freeze.outputs.release-branch }}'/g" {} + + + - name: Show status + run: | + cd ${{ github.run_id }} + git status + + - name: Create PR + uses: peter-evans/create-pull-request@v6 + id: create-pull-request + if: ${{ inputs.dry-run != true }} + with: + path: ${{ github.run_id }} + base: ${{ needs.code-freeze.outputs.release-branch }} + branch: ci/freeze-tags-${{ needs.code-freeze.outputs.release-branch }} + title: "Freeze tags in in `${{ needs.code-freeze.outputs.release-branch }}`" + body: | + 🚀 PR to freeze tags in `${{ needs.code-freeze.outputs.release-branch }}`. + + commit-message: "[🤠]: Howdy folks, let's release NeMo `${{ needs.code-freeze.outputs.release-branch }}` !" + signoff: true + assignees: okoenig diff --git a/western_ai/canada/nemo/.github/workflows/release-nightly-docs.yml b/western_ai/canada/nemo/.github/workflows/release-nightly-docs.yml new file mode 100644 index 0000000000000000000000000000000000000000..8136e080cd90261de9e035d944f384770479cc8c --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/release-nightly-docs.yml @@ -0,0 +1,29 @@ +# Copyright (c) 2026, NVIDIA CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Release Nightly Docs + +on: + schedule: + - cron: "0 10 * * *" + +jobs: + call-release-docs: + uses: ./.github/workflows/release-docs.yml + with: + dry-run: false + publish-as-latest: false + docs-version-override: "nightly" + update-version-picker: false + secrets: inherit diff --git a/western_ai/canada/nemo/.github/workflows/release.yml b/western_ai/canada/nemo/.github/workflows/release.yml new file mode 100644 index 0000000000000000000000000000000000000000..b16d583b51cf97653a6d64448d57e6f9b4ab1737 --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/release.yml @@ -0,0 +1,127 @@ +# Copyright (c) 2020-2026, NVIDIA CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: "Build, validate, and release Neural Modules" + +on: + push: + branches: + - main + - "r**" + - "pull-request/**" + - "deploy-release/*" + workflow_dispatch: + inputs: + release-ref: + description: Ref (SHA or branch name) to release + required: true + type: string + version-bump-branch: + description: Branch for version bump + required: true + type: string + dry-run: + description: Compute the release but do not publish wheel, GH release, or docs. + required: true + default: true + type: boolean + create-gh-release: + description: Create a GitHub release + required: true + default: true + type: boolean + generate-changelog: + description: Generate changelog + required: false + default: true + type: boolean + publish-docs: + description: Publish docs + required: false + default: true + type: boolean + gh-release-from-tag: + description: Tag of previous release for changelog builder + required: false + type: string + default: "" + +defaults: + run: + shell: bash -x -e -u -o pipefail {0} + +permissions: + id-token: write + contents: write + pull-requests: write + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.event_name }} + cancel-in-progress: ${{ github.event_name == 'push' }} + +jobs: + pre-flight: + if: github.event_name != 'workflow_dispatch' + uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/_cicd_preflight.yml@v0.94.1 + + release: + needs: [pre-flight] + if: | + !cancelled() && !failure() + && !(needs.pre-flight.outputs.docs_only == 'true' + || needs.pre-flight.outputs.is_deployment_workflow == 'true') + uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/_release_library.yml@v1.4.3 + with: + release-ref: ${{ inputs.release-ref || github.sha }} + python-package: nemo + python-version: "3.10" + library-name: Neural Modules + validate-only: ${{ github.event_name != 'workflow_dispatch' }} + dry-run: ${{ inputs.dry-run || false }} + wheel-content-ignore: "W002,W004,W005,W009" + skip-check-manifest: true + version-bump-branch: ${{ inputs.version-bump-branch || github.ref_name }} + create-gh-release: ${{ inputs.create-gh-release || true }} + app-id: ${{ vars.BOT_ID }} + gh-release-use-changelog-builder: ${{ inputs.generate-changelog || false }} + publish-docs: ${{ inputs.publish-docs || true }} + docs-target-path: nemo + docs-directory: docs/source + docs-requirements-file: requirements/requirements_docs.txt + docs-sync-all: true + docs-no-extras: "--no-extra cu12 --no-extra compiled --no-extra compiled-a100" + publish-as-latest: true + run-on-version-tag-only: ${{ github.ref_name != 'main' }} + gh-release-from-tag: ${{ inputs.gh-release-from-tag || '' }} + restrict-to-admins: true + secrets: inherit # pragma: allowlist secret + + release-summary: + needs: [pre-flight, release] + if: ${{ !cancelled() }} + runs-on: ubuntu-latest + steps: + - name: Result + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + FAILED_JOBS=$(gh run view $GITHUB_RUN_ID --repo ${{ github.repository }} --json jobs --jq '[.jobs[] | select(.conclusion == "failure" or .conclusion == "timed_out" or .conclusion == "action_required")] | length') + + if [ "${FAILED_JOBS:-0}" -eq 0 ]; then + echo "✅ All previous jobs completed successfully" + exit 0 + else + echo "❌ Found $FAILED_JOBS failed job(s)" + gh run view $GITHUB_RUN_ID --repo ${{ github.repository }} --json jobs --jq '.jobs[] | select(.conclusion == "failure" or .conclusion == "timed_out" or .conclusion == "action_required") | .name' + exit 1 + fi diff --git a/western_ai/canada/nemo/.github/workflows/secrets-detector.yml b/western_ai/canada/nemo/.github/workflows/secrets-detector.yml new file mode 100644 index 0000000000000000000000000000000000000000..1ae01bbac6b4cc8a3265cc0d7af20086073cbd0a --- /dev/null +++ b/western_ai/canada/nemo/.github/workflows/secrets-detector.yml @@ -0,0 +1,43 @@ +# Copyright (c) 2020-2021, NVIDIA CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: Secrets detector + +on: + pull_request_target: + branches: + - 'main' + +jobs: + main: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v6 + with: + fetch-depth: 0 + token: ${{ secrets.NEMO_REFORMAT_TOKEN }} + + - name: Install secrets detector + run: pip install detect-secrets + + - name: Run on change-set + run: | + git diff --name-only --diff-filter=d --merge-base origin/main -z | xargs -0 detect-secrets-hook --disable-plugin HexHighEntropyString --baseline .secrets.baseline + + - uses: EndBug/add-and-commit@v9 + # Commit changes. Nothing is committed if no changes. + if: always() + with: + message: Update baseline + commit: --signoff diff --git a/western_ai/canada/nemo/.gitignore b/western_ai/canada/nemo/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..800bd77768e92ac4ee86279f3fc66e950f811b5d --- /dev/null +++ b/western_ai/canada/nemo/.gitignore @@ -0,0 +1,197 @@ +# log and data files +*.model +*.pkl +#*.ipynb +output +output_2048 +result +*.pt +tests/data/asr +.DS_Store +bert.pt.json +work +runs +fastspeech_output +.hydra +.bash_history.local + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class +**.pyc + +# C extensions +*.so + +# Distribution / packaging +.idea +.Python +wandb +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +#parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/build +docs/source/_build + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# Override Jupyter in Github Language states for more accurate estimate of repo code. +# Reference: https://github.com/github/linguist/blob/master/docs/overrides.md#generated-code +*.ipynb linguist-generated + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don’t work, or not +# install all needed dependencies. +#Pipfile.lock + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# VSCode project settins +.vscode/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site +/docs/html +/docs/docs_zh/zh + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# Emacs backup files +*~ + +cifar-10-batches-py +*.tar.gz + +# Test data. +tests/.data +tests/data + +# outputs folder +examples/*/outputs +examples/*/NeMo_experiments +examples/*/nemo_experiments +examples/*/.hydra +examples/*/wandb +examples/*/data +wandb +dump.py + +docs/sources/source/test_build/ + +# Checkpoints, config files and temporary files created in tutorials. +examples/neural_graphs/*.chkpt +examples/neural_graphs/*.yml + +.hydra/ +nemo_experiments/ + +slurm*.out + +# Onelogger +onelogger.* + +# voice agent +node_modules/ +.vite/ +bot_server.* +audio_logs/ +eval_results/ + +# agents +.claude/settings.local.json diff --git a/western_ai/canada/nemo/.pre-commit-config.yaml b/western_ai/canada/nemo/.pre-commit-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8ffaa44ce548934eeb138e2694c19a4c664dfc30 --- /dev/null +++ b/western_ai/canada/nemo/.pre-commit-config.yaml @@ -0,0 +1,45 @@ +# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +default_language_version: + python: python3 + +ci: + autofix_prs: true + autoupdate_commit_msg: '[pre-commit.ci] pre-commit suggestions' + autoupdate_schedule: quarterly + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: check-yaml + - id: check-case-conflict + - id: detect-private-key + - id: check-added-large-files + args: ['--maxkb=1000'] + - id: requirements-txt-fixer + + - repo: https://github.com/PyCQA/isort + rev: 5.13.2 + hooks: + - id: isort + name: Format imports + exclude: docs/ + + # Using this mirror lets us use mypyc-compiled black, which is about 2x faster + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 24.10.0 + hooks: + - id: black \ No newline at end of file diff --git a/western_ai/canada/nemo/.pylintrc b/western_ai/canada/nemo/.pylintrc new file mode 100644 index 0000000000000000000000000000000000000000..662d427c3b16ac36c6b636d3c0db69a5d9defabf --- /dev/null +++ b/western_ai/canada/nemo/.pylintrc @@ -0,0 +1,5 @@ +[MAIN] +ignore-paths=tests +max-line-length=119 +ignore-patterns=.*\.ipynb$ +recursive=y diff --git a/western_ai/canada/nemo/.pylintrc.other b/western_ai/canada/nemo/.pylintrc.other new file mode 100644 index 0000000000000000000000000000000000000000..19d69827d873d5fc32fbd48624eecd76daa2d4b2 --- /dev/null +++ b/western_ai/canada/nemo/.pylintrc.other @@ -0,0 +1,12 @@ +[MAIN] +ignore-paths=tests +max-line-length=119 + +[MESSAGES CONTROL] +disable=all + +enable=C0115,C0116,W0611,C0301 +# C0115: missing-class-docstring +# C0116: missing-function-docstring +# W0611: unused-import +# C0301: line-too-long diff --git a/western_ai/canada/nemo/.pylintrc.speech b/western_ai/canada/nemo/.pylintrc.speech new file mode 100644 index 0000000000000000000000000000000000000000..62dc268cc958f986cb8818d81451ec9736fc1c23 --- /dev/null +++ b/western_ai/canada/nemo/.pylintrc.speech @@ -0,0 +1,9 @@ +[MAIN] +ignore-paths=tests +max-line-length=119 + +[MESSAGES CONTROL] +disable=all + +enable=W0611 +# W0611: unused-import diff --git a/western_ai/canada/nemo/.readthedocs.yml b/western_ai/canada/nemo/.readthedocs.yml new file mode 100644 index 0000000000000000000000000000000000000000..bd22456713305f6a40942a5831c8042e278b48f0 --- /dev/null +++ b/western_ai/canada/nemo/.readthedocs.yml @@ -0,0 +1,35 @@ +# ============================================================================= +# Copyright (c) 2020 NVIDIA. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================= + +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required field. +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3.10" + +# Build documentation in the docs/ directory with Sphinx. +sphinx: + configuration: docs/source/conf.py + +# Set the version of Python and requirements required to build your docs +python: + install: + - requirements: requirements/requirements_docs.txt diff --git a/western_ai/canada/nemo/.secrets.baseline b/western_ai/canada/nemo/.secrets.baseline new file mode 100644 index 0000000000000000000000000000000000000000..0840e30fa97c80f6a0b9a00e4ec6800e218b2c7d --- /dev/null +++ b/western_ai/canada/nemo/.secrets.baseline @@ -0,0 +1,2082 @@ +{ + "version": "1.5.0", + "plugins_used": [ + { + "name": "ArtifactoryDetector" + }, + { + "name": "AWSKeyDetector" + }, + { + "name": "AzureStorageKeyDetector" + }, + { + "name": "Base64HighEntropyString", + "limit": 4.5 + }, + { + "name": "BasicAuthDetector" + }, + { + "name": "CloudantDetector" + }, + { + "name": "DiscordBotTokenDetector" + }, + { + "name": "GitHubTokenDetector" + }, + { + "name": "GitLabTokenDetector" + }, + { + "name": "HexHighEntropyString", + "limit": 3.0 + }, + { + "name": "IbmCloudIamDetector" + }, + { + "name": "IbmCosHmacDetector" + }, + { + "name": "IPPublicDetector" + }, + { + "name": "JwtTokenDetector" + }, + { + "name": "KeywordDetector", + "keyword_exclude": "" + }, + { + "name": "MailchimpDetector" + }, + { + "name": "NpmDetector" + }, + { + "name": "OpenAIDetector" + }, + { + "name": "PrivateKeyDetector" + }, + { + "name": "PypiTokenDetector" + }, + { + "name": "SendGridDetector" + }, + { + "name": "SlackDetector" + }, + { + "name": "SoftlayerDetector" + }, + { + "name": "SquareOAuthDetector" + }, + { + "name": "StripeDetector" + }, + { + "name": "TelegramBotTokenDetector" + }, + { + "name": "TwilioKeyDetector" + } + ], + "filters_used": [ + { + "path": "detect_secrets.filters.allowlist.is_line_allowlisted" + }, + { + "path": "detect_secrets.filters.common.is_baseline_file", + "filename": ".secrets.baseline" + }, + { + "path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies", + "min_level": 2 + }, + { + "path": "detect_secrets.filters.heuristic.is_indirect_reference" + }, + { + "path": "detect_secrets.filters.heuristic.is_likely_id_string" + }, + { + "path": "detect_secrets.filters.heuristic.is_lock_file" + }, + { + "path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string" + }, + { + "path": "detect_secrets.filters.heuristic.is_potential_uuid" + }, + { + "path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign" + }, + { + "path": "detect_secrets.filters.heuristic.is_sequential_string" + }, + { + "path": "detect_secrets.filters.heuristic.is_swagger_file" + }, + { + "path": "detect_secrets.filters.heuristic.is_templated_secret" + } + ], + "results": { + ".github/workflows/node-reboot.yml": [ + { + "type": "Secret Keyword", + "filename": ".github/workflows/node-reboot.yml", + "hashed_secret": "3e26d6750975d678acb8fa35a0f69237881576b0", + "is_verified": false, + "line_number": 52 + } + ], + "docs/source/nlp/question_answering.rst": [ + { + "type": "Hex High Entropy String", + "filename": "docs/source/nlp/question_answering.rst", + "hashed_secret": "22e6f19f702bbd215acc1862da6acba7e874674e", + "is_verified": false, + "line_number": 130 + } + ], + "examples/multimodal/multimodal_llm/neva/conf/lita_config.yaml": [ + { + "type": "Base64 High Entropy String", + "filename": "examples/multimodal/multimodal_llm/neva/conf/lita_config.yaml", + "hashed_secret": "a90ca639abde504aba67797b0663923a0075fe6e", + "is_verified": false, + "line_number": 75 + } + ], + "examples/multimodal/multimodal_llm/neva/conf/neva_inference.yaml": [ + { + "type": "Secret Keyword", + "filename": "examples/multimodal/multimodal_llm/neva/conf/neva_inference.yaml", + "hashed_secret": "109f4b3c50d7b0df729d299bc6f8e9ef9066971f", + "is_verified": false, + "line_number": 50 + } + ], + "examples/nlp/information_retrieval/conf/megatron_gpt_embedder_generate_config.yaml": [ + { + "type": "Secret Keyword", + "filename": "examples/nlp/information_retrieval/conf/megatron_gpt_embedder_generate_config.yaml", + "hashed_secret": "109f4b3c50d7b0df729d299bc6f8e9ef9066971f", + "is_verified": false, + "line_number": 165 + } + ], + "examples/nlp/language_modeling/conf/megatron_baichuan2_inference.yaml": [ + { + "type": "Secret Keyword", + "filename": "examples/nlp/language_modeling/conf/megatron_baichuan2_inference.yaml", + "hashed_secret": "109f4b3c50d7b0df729d299bc6f8e9ef9066971f", + "is_verified": false, + "line_number": 38 + } + ], + "examples/nlp/language_modeling/conf/megatron_chatglm_inference.yaml": [ + { + "type": "Secret Keyword", + "filename": "examples/nlp/language_modeling/conf/megatron_chatglm_inference.yaml", + "hashed_secret": "109f4b3c50d7b0df729d299bc6f8e9ef9066971f", + "is_verified": false, + "line_number": 38 + } + ], + "examples/nlp/language_modeling/conf/megatron_falcon_inference.yaml": [ + { + "type": "Secret Keyword", + "filename": "examples/nlp/language_modeling/conf/megatron_falcon_inference.yaml", + "hashed_secret": "109f4b3c50d7b0df729d299bc6f8e9ef9066971f", + "is_verified": false, + "line_number": 37 + } + ], + "examples/nlp/language_modeling/conf/megatron_gpt_inference.yaml": [ + { + "type": "Secret Keyword", + "filename": "examples/nlp/language_modeling/conf/megatron_gpt_inference.yaml", + "hashed_secret": "109f4b3c50d7b0df729d299bc6f8e9ef9066971f", + "is_verified": false, + "line_number": 41 + } + ], + "examples/nlp/language_modeling/conf/megatron_griffin_generate_config.yaml": [ + { + "type": "Secret Keyword", + "filename": "examples/nlp/language_modeling/conf/megatron_griffin_generate_config.yaml", + "hashed_secret": "109f4b3c50d7b0df729d299bc6f8e9ef9066971f", + "is_verified": false, + "line_number": 239 + } + ], + "examples/nlp/language_modeling/conf/megatron_llama_inference.yaml": [ + { + "type": "Secret Keyword", + "filename": "examples/nlp/language_modeling/conf/megatron_llama_inference.yaml", + "hashed_secret": "109f4b3c50d7b0df729d299bc6f8e9ef9066971f", + "is_verified": false, + "line_number": 38 + } + ], + "examples/nlp/language_modeling/conf/megatron_mamba_inference.yaml": [ + { + "type": "Secret Keyword", + "filename": "examples/nlp/language_modeling/conf/megatron_mamba_inference.yaml", + "hashed_secret": "109f4b3c50d7b0df729d299bc6f8e9ef9066971f", + "is_verified": false, + "line_number": 40 + } + ], + "examples/nlp/language_modeling/conf/megatron_qwen2_inference.yaml": [ + { + "type": "Secret Keyword", + "filename": "examples/nlp/language_modeling/conf/megatron_qwen2_inference.yaml", + "hashed_secret": "109f4b3c50d7b0df729d299bc6f8e9ef9066971f", + "is_verified": false, + "line_number": 38 + } + ], + "examples/nlp/language_modeling/tuning/conf/megatron_gpt_generate_config.yaml": [ + { + "type": "Secret Keyword", + "filename": "examples/nlp/language_modeling/tuning/conf/megatron_gpt_generate_config.yaml", + "hashed_secret": "109f4b3c50d7b0df729d299bc6f8e9ef9066971f", + "is_verified": false, + "line_number": 160 + } + ], + "examples/nlp/language_modeling/tuning/conf/megatron_mamba_generate_config.yaml": [ + { + "type": "Secret Keyword", + "filename": "examples/nlp/language_modeling/tuning/conf/megatron_mamba_generate_config.yaml", + "hashed_secret": "109f4b3c50d7b0df729d299bc6f8e9ef9066971f", + "is_verified": false, + "line_number": 168 + } + ], + "examples/nlp/language_modeling/tuning/conf/megatron_t5_generate_config.yaml": [ + { + "type": "Secret Keyword", + "filename": "examples/nlp/language_modeling/tuning/conf/megatron_t5_generate_config.yaml", + "hashed_secret": "109f4b3c50d7b0df729d299bc6f8e9ef9066971f", + "is_verified": false, + "line_number": 157 + } + ], + "scripts/checkpoint_converters/convert_mistral_7b_hf_to_nemo.py": [ + { + "type": "Hex High Entropy String", + "filename": "scripts/checkpoint_converters/convert_mistral_7b_hf_to_nemo.py", + "hashed_secret": "e0308bd21bffc156d79208f9ecf130370a015002", + "is_verified": false, + "line_number": 471 + } + ], + "scripts/dataset_processing/nlp/intent_and_slot/assistant_utils.py": [ + { + "type": "Base64 High Entropy String", + "filename": "scripts/dataset_processing/nlp/intent_and_slot/assistant_utils.py", + "hashed_secret": "adfce53cfc5a36ea58ba816ea6d005231db6455c", + "is_verified": false, + "line_number": 40 + } + ], + "scripts/nlp_language_modeling/service_launch_scripts/conf/retro_web_server.yaml": [ + { + "type": "Secret Keyword", + "filename": "scripts/nlp_language_modeling/service_launch_scripts/conf/retro_web_server.yaml", + "hashed_secret": "109f4b3c50d7b0df729d299bc6f8e9ef9066971f", + "is_verified": false, + "line_number": 9 + } + ], + "scripts/nlp_language_modeling/service_launch_scripts/env_variables.sh": [ + { + "type": "Secret Keyword", + "filename": "scripts/nlp_language_modeling/service_launch_scripts/env_variables.sh", + "hashed_secret": "109f4b3c50d7b0df729d299bc6f8e9ef9066971f", + "is_verified": false, + "line_number": 33 + } + ], + "scripts/tts_dataset_files/cmudict-0.7b_nv22.10": [ + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/cmudict-0.7b_nv22.10", + "hashed_secret": "27b998c0976876189b861934085bba2964e49a11", + "is_verified": false, + "line_number": 4873 + } + ], + "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict": [ + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "6a1c698aa2f0b96b536710f5a2abd0ca64fdb2c1", + "is_verified": false, + "line_number": 8415 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "9a611ff964db23d7cd8a6f63beb7471144f6be92", + "is_verified": false, + "line_number": 8421 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "f2f0bc1252ccb8bbc113859849f8c36be203fd9e", + "is_verified": false, + "line_number": 8424 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "b65cab561c4acd1e20bafd08ce19a9e7b5ea9e1c", + "is_verified": false, + "line_number": 8431 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "c08ba5eff4953649130e83149817e1087c183358", + "is_verified": false, + "line_number": 8433 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "b182776899d0959f28f3d80c7d50317de5c0fb2b", + "is_verified": false, + "line_number": 8441 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "e466719c0309450475aa6b0e0c53a2211db0176d", + "is_verified": false, + "line_number": 8442 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "0e7ae57946d9c88ce5f017ac50640e2c93c5277b", + "is_verified": false, + "line_number": 8443 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "6d13086a143b48a00e3aa745a955095fbbc075b2", + "is_verified": false, + "line_number": 8444 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "d206dd2b79987f5989b23a7a43d6163ed48312f0", + "is_verified": false, + "line_number": 8446 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "be10bcbbe755bdd51e856af50af01bb4f95bfedb", + "is_verified": false, + "line_number": 8449 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "2f00d2108827b933019dbedc8cc3f9c84f3bfe1e", + "is_verified": false, + "line_number": 8451 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "a705c12d23346a892256fa95c892304bd8f4d265", + "is_verified": false, + "line_number": 8454 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "2471810862c167bed6c3a8383dd410aedb8cb7e1", + "is_verified": false, + "line_number": 8456 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "34befc5cf63e9c9259c7e75714c81db892419549", + "is_verified": false, + "line_number": 8464 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "343d4559dcb06080b6fc5a9f42fbb88b6e343526", + "is_verified": false, + "line_number": 8470 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "96631b5faaa50b4d24076072a357a13f48f1435f", + "is_verified": false, + "line_number": 8472 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "c5be9fd8c751b6d2ff6219c63de90e4aa9f97546", + "is_verified": false, + "line_number": 8477 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "4f68de76b2c605cb67d99b1e97b1461ef4618db2", + "is_verified": false, + "line_number": 8479 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "90d1db77f31a86c5e0081468e0dbda8172b70131", + "is_verified": false, + "line_number": 8508 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "6f3ce73b5dfbe7e4948bdad86c804ce74e17e0cf", + "is_verified": false, + "line_number": 8510 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "a1f22c6489b0cf0016b9364619a7d7eed95b6364", + "is_verified": false, + "line_number": 8512 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "b55ad569f88dc7e42868047f4f4a59c3cb6c110a", + "is_verified": false, + "line_number": 8519 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "f2c207cddfe45b6c893619c3757f264f721025c6", + "is_verified": false, + "line_number": 8521 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "d1371bfdfaf5d02731488ca6b6f12e51617813ab", + "is_verified": false, + "line_number": 8549 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "76d22e171aa272dbdd6d1d67c23d9f700362f09a", + "is_verified": false, + "line_number": 8555 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "0efe19de03cdaa4a382654246b4bff22dd79e518", + "is_verified": false, + "line_number": 8568 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "d318e8342db9deb2f6827f39fad6229ca4e4521a", + "is_verified": false, + "line_number": 8581 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "fb99a4a93e08e86cf5f4475aba66e85def711752", + "is_verified": false, + "line_number": 8586 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "04ebb8445e6050d78c4636b19a17221387216b0d", + "is_verified": false, + "line_number": 8588 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "2ec592daffb8a6e8c402690f7aadac6475c5f2ec", + "is_verified": false, + "line_number": 8591 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "f7df3933dce6e3f5843b7e55ccff8f2516302229", + "is_verified": false, + "line_number": 8601 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "fe860f7095f48e2f6a63b97124da4afd8c987895", + "is_verified": false, + "line_number": 8606 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "abd3d69f7d8c98bb7fe98cb6aa41bf3d42d23911", + "is_verified": false, + "line_number": 8609 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "2070834a550a6fbae2a3912e1117fa9f4270752b", + "is_verified": false, + "line_number": 8619 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "e7d64bf030b802c205af2832114589c141ea1f33", + "is_verified": false, + "line_number": 8622 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "c84bccf09830b2804e4d59e8bf82393ae76a8b03", + "is_verified": false, + "line_number": 8625 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "86888ce709ad4a2590221da4f4d602a254443470", + "is_verified": false, + "line_number": 8628 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "ae5da5b749fe3b2aea4957c7ee83938a75622bb7", + "is_verified": false, + "line_number": 8645 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "94ccf1bc68c1a19f5733d9ac6e5bb60166e6530d", + "is_verified": false, + "line_number": 8647 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "892dbf65134c4dfb554a16f5fc387ef153e269ed", + "is_verified": false, + "line_number": 8697 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "61bfa79fd6923bc44a8c8c500b8992a66f5ae340", + "is_verified": false, + "line_number": 8703 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "db880cb9754850e54f247dc1f7d1cce5f80ec056", + "is_verified": false, + "line_number": 8718 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "a020736e7f661dc0d7985bfdcfadb7dce8db6216", + "is_verified": false, + "line_number": 8719 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "ee8ddcdb18d90b8ddc8d9d4bb28e7fe700965ea8", + "is_verified": false, + "line_number": 8720 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "f5726d5cd941bc5fd7cd26fdbf6d1ed5750e55bd", + "is_verified": false, + "line_number": 8721 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "49e5b074ecc6a910f32617b1d2103849177a254e", + "is_verified": false, + "line_number": 8750 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "e0a73b397eafd55a2f9cac7b031bf8716bc2b79e", + "is_verified": false, + "line_number": 8751 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "9c593b1ecb2cfed50a12793d23fb3fc0cd5f5e21", + "is_verified": false, + "line_number": 8762 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "e1db0a80a43c626e55171566c5823588cfb02fd8", + "is_verified": false, + "line_number": 8764 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "a5f7d1f0a545e46e361e56191788d0f5fee625fb", + "is_verified": false, + "line_number": 8772 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "4d199d4ccaea5f654b23dbc22e54acd79cc76e8c", + "is_verified": false, + "line_number": 8774 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "865d1b874b4cd866febe48e024ed94af5303f808", + "is_verified": false, + "line_number": 8775 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "fa25b96c74c4f77bb3eb89c55a7ab88550d12de5", + "is_verified": false, + "line_number": 8776 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "a21fc67d6e3ff4d5f39596793a9e2b01c608d69f", + "is_verified": false, + "line_number": 8777 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "b2e00015ad1a9cb779655b48a19eff8c834bc36e", + "is_verified": false, + "line_number": 8778 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "ca51add4d292a3744a883a8844bcbf067b34b468", + "is_verified": false, + "line_number": 8779 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "8479cbf554082f4f4b3c9587f21c62f406940e93", + "is_verified": false, + "line_number": 8782 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "d1edb7ebbefe0dd0dfcddce8e0b7e63e74430a5b", + "is_verified": false, + "line_number": 8784 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "c8b9b705e819ebeba33d4ff4f6dc638a9ee1f47c", + "is_verified": false, + "line_number": 8787 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "250c748db4a13f7a3cff6ff0934bb0338e9f3190", + "is_verified": false, + "line_number": 8788 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "6035f3432d36e33f2a57c3c6ee62014a9fb95a19", + "is_verified": false, + "line_number": 8789 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_ES/es_ES_nv230301.dict", + "hashed_secret": "82b23ffc5cea766826613f29718bc1e3023f58e8", + "is_verified": false, + "line_number": 8790 + } + ], + "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict": [ + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "6a1c698aa2f0b96b536710f5a2abd0ca64fdb2c1", + "is_verified": false, + "line_number": 8743 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "9a611ff964db23d7cd8a6f63beb7471144f6be92", + "is_verified": false, + "line_number": 8751 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "f2f0bc1252ccb8bbc113859849f8c36be203fd9e", + "is_verified": false, + "line_number": 8755 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "b65cab561c4acd1e20bafd08ce19a9e7b5ea9e1c", + "is_verified": false, + "line_number": 8764 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "c08ba5eff4953649130e83149817e1087c183358", + "is_verified": false, + "line_number": 8766 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "b182776899d0959f28f3d80c7d50317de5c0fb2b", + "is_verified": false, + "line_number": 8774 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "e466719c0309450475aa6b0e0c53a2211db0176d", + "is_verified": false, + "line_number": 8775 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "0e7ae57946d9c88ce5f017ac50640e2c93c5277b", + "is_verified": false, + "line_number": 8776 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "6d13086a143b48a00e3aa745a955095fbbc075b2", + "is_verified": false, + "line_number": 8777 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "d206dd2b79987f5989b23a7a43d6163ed48312f0", + "is_verified": false, + "line_number": 8779 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "be10bcbbe755bdd51e856af50af01bb4f95bfedb", + "is_verified": false, + "line_number": 8782 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "2f00d2108827b933019dbedc8cc3f9c84f3bfe1e", + "is_verified": false, + "line_number": 8784 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "a705c12d23346a892256fa95c892304bd8f4d265", + "is_verified": false, + "line_number": 8787 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "2471810862c167bed6c3a8383dd410aedb8cb7e1", + "is_verified": false, + "line_number": 8789 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "34befc5cf63e9c9259c7e75714c81db892419549", + "is_verified": false, + "line_number": 8797 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "343d4559dcb06080b6fc5a9f42fbb88b6e343526", + "is_verified": false, + "line_number": 8803 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "96631b5faaa50b4d24076072a357a13f48f1435f", + "is_verified": false, + "line_number": 8805 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "c5be9fd8c751b6d2ff6219c63de90e4aa9f97546", + "is_verified": false, + "line_number": 8810 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "4f68de76b2c605cb67d99b1e97b1461ef4618db2", + "is_verified": false, + "line_number": 8812 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "90d1db77f31a86c5e0081468e0dbda8172b70131", + "is_verified": false, + "line_number": 8841 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "6f3ce73b5dfbe7e4948bdad86c804ce74e17e0cf", + "is_verified": false, + "line_number": 8843 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "a1f22c6489b0cf0016b9364619a7d7eed95b6364", + "is_verified": false, + "line_number": 8845 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "b55ad569f88dc7e42868047f4f4a59c3cb6c110a", + "is_verified": false, + "line_number": 8854 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "f2c207cddfe45b6c893619c3757f264f721025c6", + "is_verified": false, + "line_number": 8856 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "d1371bfdfaf5d02731488ca6b6f12e51617813ab", + "is_verified": false, + "line_number": 8884 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "76d22e171aa272dbdd6d1d67c23d9f700362f09a", + "is_verified": false, + "line_number": 8890 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "0efe19de03cdaa4a382654246b4bff22dd79e518", + "is_verified": false, + "line_number": 8903 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "d318e8342db9deb2f6827f39fad6229ca4e4521a", + "is_verified": false, + "line_number": 8916 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "fb99a4a93e08e86cf5f4475aba66e85def711752", + "is_verified": false, + "line_number": 8921 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "04ebb8445e6050d78c4636b19a17221387216b0d", + "is_verified": false, + "line_number": 8923 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "2ec592daffb8a6e8c402690f7aadac6475c5f2ec", + "is_verified": false, + "line_number": 8926 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "f7df3933dce6e3f5843b7e55ccff8f2516302229", + "is_verified": false, + "line_number": 8936 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "fe860f7095f48e2f6a63b97124da4afd8c987895", + "is_verified": false, + "line_number": 8941 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "abd3d69f7d8c98bb7fe98cb6aa41bf3d42d23911", + "is_verified": false, + "line_number": 8944 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "2070834a550a6fbae2a3912e1117fa9f4270752b", + "is_verified": false, + "line_number": 8954 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "e7d64bf030b802c205af2832114589c141ea1f33", + "is_verified": false, + "line_number": 8958 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "c84bccf09830b2804e4d59e8bf82393ae76a8b03", + "is_verified": false, + "line_number": 8962 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "86888ce709ad4a2590221da4f4d602a254443470", + "is_verified": false, + "line_number": 8966 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "ae5da5b749fe3b2aea4957c7ee83938a75622bb7", + "is_verified": false, + "line_number": 8997 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "94ccf1bc68c1a19f5733d9ac6e5bb60166e6530d", + "is_verified": false, + "line_number": 8999 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "892dbf65134c4dfb554a16f5fc387ef153e269ed", + "is_verified": false, + "line_number": 9050 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "61bfa79fd6923bc44a8c8c500b8992a66f5ae340", + "is_verified": false, + "line_number": 9058 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "db880cb9754850e54f247dc1f7d1cce5f80ec056", + "is_verified": false, + "line_number": 9076 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "a020736e7f661dc0d7985bfdcfadb7dce8db6216", + "is_verified": false, + "line_number": 9077 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "ee8ddcdb18d90b8ddc8d9d4bb28e7fe700965ea8", + "is_verified": false, + "line_number": 9078 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "f5726d5cd941bc5fd7cd26fdbf6d1ed5750e55bd", + "is_verified": false, + "line_number": 9079 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "49e5b074ecc6a910f32617b1d2103849177a254e", + "is_verified": false, + "line_number": 9108 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "e0a73b397eafd55a2f9cac7b031bf8716bc2b79e", + "is_verified": false, + "line_number": 9109 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "9c593b1ecb2cfed50a12793d23fb3fc0cd5f5e21", + "is_verified": false, + "line_number": 9120 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "e1db0a80a43c626e55171566c5823588cfb02fd8", + "is_verified": false, + "line_number": 9122 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "a5f7d1f0a545e46e361e56191788d0f5fee625fb", + "is_verified": false, + "line_number": 9130 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "4d199d4ccaea5f654b23dbc22e54acd79cc76e8c", + "is_verified": false, + "line_number": 9132 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "865d1b874b4cd866febe48e024ed94af5303f808", + "is_verified": false, + "line_number": 9133 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "fa25b96c74c4f77bb3eb89c55a7ab88550d12de5", + "is_verified": false, + "line_number": 9134 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "a21fc67d6e3ff4d5f39596793a9e2b01c608d69f", + "is_verified": false, + "line_number": 9135 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "b2e00015ad1a9cb779655b48a19eff8c834bc36e", + "is_verified": false, + "line_number": 9136 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "ca51add4d292a3744a883a8844bcbf067b34b468", + "is_verified": false, + "line_number": 9137 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "8479cbf554082f4f4b3c9587f21c62f406940e93", + "is_verified": false, + "line_number": 9140 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "d1edb7ebbefe0dd0dfcddce8e0b7e63e74430a5b", + "is_verified": false, + "line_number": 9142 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "c8b9b705e819ebeba33d4ff4f6dc638a9ee1f47c", + "is_verified": false, + "line_number": 9145 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "250c748db4a13f7a3cff6ff0934bb0338e9f3190", + "is_verified": false, + "line_number": 9146 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "6035f3432d36e33f2a57c3c6ee62014a9fb95a19", + "is_verified": false, + "line_number": 9147 + }, + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/es_LA/es_LA_nv230301.dict", + "hashed_secret": "82b23ffc5cea766826613f29718bc1e3023f58e8", + "is_verified": false, + "line_number": 9148 + } + ], + "scripts/tts_dataset_files/ipa_cmudict-0.7b_nv23.01.txt": [ + { + "type": "Artifactory Credentials", + "filename": "scripts/tts_dataset_files/ipa_cmudict-0.7b_nv23.01.txt", + "hashed_secret": "27b998c0976876189b861934085bba2964e49a11", + "is_verified": false, + "line_number": 4886 + } + ], + "tests/hydra/config1_invalid.yaml": [ + { + "type": "Secret Keyword", + "filename": "tests/hydra/config1_invalid.yaml", + "hashed_secret": "e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4", + "is_verified": false, + "line_number": 2 + } + ], + "tests/hydra/config_subdir/config2_invalid.yaml": [ + { + "type": "Secret Keyword", + "filename": "tests/hydra/config_subdir/config2_invalid.yaml", + "hashed_secret": "ebf1f14a3530cd22650b951908b5159f1f2a3ca8", + "is_verified": false, + "line_number": 2 + } + ], + "tutorials/asr/Multilang_ASR.ipynb": [ + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "23ab3508f39164c81139e2bc866ebe46b69248f3", + "is_verified": false, + "line_number": 562 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "bfbd2a23ecc348e67d5cb55f2db6bf9f9cebb325", + "is_verified": false, + "line_number": 563 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "81dee32e25f1d0c256140df030b2531dde332acb", + "is_verified": false, + "line_number": 564 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "4af542b2d6e243a440ad4cf2815d6e2237808df5", + "is_verified": false, + "line_number": 565 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "a67ed767388e7eece04b5c6f7b568ddf29edac7c", + "is_verified": false, + "line_number": 566 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "c022505b9f732f0cb352fe8ed5fc278912b46488", + "is_verified": false, + "line_number": 567 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "182d4019337b9c8786b6e34a83441a21bad1874b", + "is_verified": false, + "line_number": 568 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "740eb48367bc73edfc56bc4414e9b2662736566c", + "is_verified": false, + "line_number": 569 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "b1aef696788110cd1e18595d6cebb0959d36adfa", + "is_verified": false, + "line_number": 570 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "c7fe8bf177365ffe460c15da553c7368ddfdbaa7", + "is_verified": false, + "line_number": 571 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "f3112d03411e69f7a23d5d1582079e1173cd032e", + "is_verified": false, + "line_number": 572 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "46859f9c2007195e9762d88c36247d018859f09d", + "is_verified": false, + "line_number": 676 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "afc8f88c8c20204370c5f35925ef36fc71c71379", + "is_verified": false, + "line_number": 677 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "df94d52f84db3fa667993f544ea80aca4f9a2125", + "is_verified": false, + "line_number": 678 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "783c5002441b0a6225cc26f71864f7f8504ef819", + "is_verified": false, + "line_number": 679 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "469b7833ff898575016f6df77172c9fc910efdf7", + "is_verified": false, + "line_number": 680 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "90771a6f73123f8665fe199fa920d06ff407ec72", + "is_verified": false, + "line_number": 681 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "cbf4db9d163e190540825e529b55b551ba21733a", + "is_verified": false, + "line_number": 682 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "4f58de63d50f78243fadbf94a08fc58fb51d1428", + "is_verified": false, + "line_number": 683 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "2dc56a67a4ab217c7197c4ce468e0dbe7f20d54b", + "is_verified": false, + "line_number": 684 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "a4d526869e953d0eebcfd7948f798ba1d39397c4", + "is_verified": false, + "line_number": 685 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "8109bf627c2f367f0f75ec0fc4079040d46ea65b", + "is_verified": false, + "line_number": 686 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "05d48a4ba182e2966da054c756e527a7304b586e", + "is_verified": false, + "line_number": 1148 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "a091c7128789cea09adabf026a3dbd7b0febcfef", + "is_verified": false, + "line_number": 1149 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "38403bcc580ba265c4918eaea606399cf37689a2", + "is_verified": false, + "line_number": 1150 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "d572b2cd7c13cbb69a638f2b978da146b34340df", + "is_verified": false, + "line_number": 1151 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "f97db3647a1e5869756fc4019bf198e900034e67", + "is_verified": false, + "line_number": 1152 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "ae0722be63cd884e5788cc8153a9f7728d54f72c", + "is_verified": false, + "line_number": 1153 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "d694e89fef75e8d868accaba50c224a1f2dd8399", + "is_verified": false, + "line_number": 1154 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "8e2fe85dc67f14fa2f02ffa465974dec89655856", + "is_verified": false, + "line_number": 1155 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "e23d0990cdb54a3d1dc3c9bcf922242fc7bacc64", + "is_verified": false, + "line_number": 1156 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "d49a849228aa07e957274e8b1349405868626e56", + "is_verified": false, + "line_number": 1157 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "a32050f253ef8a9f61b37ac26180efb6acf0bb30", + "is_verified": false, + "line_number": 1158 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "834213b15871dbd6b30f517de52ec9df2730eb7b", + "is_verified": false, + "line_number": 1196 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "b0555871dc9fc34a149b82e62fc72fc654b84667", + "is_verified": false, + "line_number": 1197 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "32fe03ac71cc6c8a31c72e21c9aec64557cb4fba", + "is_verified": false, + "line_number": 1198 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "3e712f05fedce2068adf4f6ac44b3759a1fbbd59", + "is_verified": false, + "line_number": 1199 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "f8472c93db4afd582aafddcc5a2dd8d568cb3e43", + "is_verified": false, + "line_number": 1200 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "1d8c14b1e24558e9cdbd47644f36c5675edcdcca", + "is_verified": false, + "line_number": 1201 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "2a11395949beadb049a0cd129b6f5e3aa3782814", + "is_verified": false, + "line_number": 1202 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "edae2d92434824df126daa3340589b60da2afa67", + "is_verified": false, + "line_number": 1203 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "cc9e0c1b12b1abaffa7eb6cbccbee72f65ac1535", + "is_verified": false, + "line_number": 1204 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "e80f107771869ec656d0cf6e8486486b69f922ae", + "is_verified": false, + "line_number": 1205 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "160fb2093e3388000d26c76d25428170a035bdcf", + "is_verified": false, + "line_number": 1206 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "9488ce4f041c4c3b404ff21110170940ce5295f2", + "is_verified": false, + "line_number": 2028 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "4fb50b7293c24d257d3b39eec254517e73cd27be", + "is_verified": false, + "line_number": 2029 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "2d3ad63f96d6f447f63a2ec9d451ba34a8c8013e", + "is_verified": false, + "line_number": 2030 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "7c0a1424bcd4d5086497ba05ff5d2b5c11112655", + "is_verified": false, + "line_number": 2031 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "5582b5110b9376a45e2329d2d127f972673287a9", + "is_verified": false, + "line_number": 2032 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "e99b32711f4beb0cd40130d75016b45ec188eac0", + "is_verified": false, + "line_number": 2033 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "5cbed1a68bafa82a8a0ff59f03c8f28148081f1e", + "is_verified": false, + "line_number": 2034 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "d7604ec9987dc19cfd2e512d1fdab6f1ceb41a7c", + "is_verified": false, + "line_number": 2035 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "b329420ee2aa11facc5a652f2bb32ca0f186c442", + "is_verified": false, + "line_number": 2036 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "f16bb2651aa872a8d12dd98e11efb58bd23da895", + "is_verified": false, + "line_number": 2037 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "74032a5243a1cf863a7e84e1749a3fac81e7290f", + "is_verified": false, + "line_number": 2038 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "b5b39748fce09b60e94b21b466c52c791d627cba", + "is_verified": false, + "line_number": 2039 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "db98703d26bdf4616c4e65036986b6355611211f", + "is_verified": false, + "line_number": 2040 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "4d14a5871469d7490614a53cab3fbfc52a7279e5", + "is_verified": false, + "line_number": 2041 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "258ddab91bab22bd68bc3015ea889521fa3fdacd", + "is_verified": false, + "line_number": 2042 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "6d7a940238710f5f734f1816fc47959ef7f95636", + "is_verified": false, + "line_number": 2043 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "de52434f2efe55aed0df2256de9abd275539cf0b", + "is_verified": false, + "line_number": 2044 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "4cd4d2a18051aaad9320442a4377cd18577f73f9", + "is_verified": false, + "line_number": 2045 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "954ca4decf6425679bb28e223ff6b137c1e9ce6e", + "is_verified": false, + "line_number": 2046 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "f6b0d563b01f1250220b29dbdf5f70c14d206be7", + "is_verified": false, + "line_number": 2047 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "99285fb5e057fc901d1877f1f0c8b8c94ecd1358", + "is_verified": false, + "line_number": 2048 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "faa5674f871179e8abe110c410403b51893c917f", + "is_verified": false, + "line_number": 2049 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "92a0615e0edaf88003fb0b6f70dc77de93828bb8", + "is_verified": false, + "line_number": 2103 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "77351aa360f4c3e50ef4cd700bba74219d5b5aa2", + "is_verified": false, + "line_number": 2104 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "c7226bd151222bb3ab574a4d21d83d97ed054112", + "is_verified": false, + "line_number": 2105 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "f73edb9e83b0f41052050055ac563973a6850afb", + "is_verified": false, + "line_number": 2106 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "346a54ded37ddfd7de0b98b3f8a6fefb92c97ec5", + "is_verified": false, + "line_number": 2107 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "078cde4cd776c14c9166304412a643cff409faa0", + "is_verified": false, + "line_number": 2108 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "4a3c4394031a7842a72b787cf5b08a165e8b7206", + "is_verified": false, + "line_number": 2109 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "406aa8259676acb13859b17f5e1f94fcdb69c0d6", + "is_verified": false, + "line_number": 2110 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "3607002f0fabd7bbbe4e90715beb1c85a6ade333", + "is_verified": false, + "line_number": 2111 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "465ee282a0d7b2cf762d9dbce0b1f356d75bc15d", + "is_verified": false, + "line_number": 2112 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "44608c743318ec5489b23a388f4f6e0f724ac0a8", + "is_verified": false, + "line_number": 2113 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "1a4251d6b7ba19233f16766868ac29e3428db4f0", + "is_verified": false, + "line_number": 2203 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "55dd3f4c1b8682cf8ec7b21243cdffe0127f0e03", + "is_verified": false, + "line_number": 2204 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "220d1fa41654cb432843792dd63e8f446eedefa9", + "is_verified": false, + "line_number": 2205 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "35654d3cde31330d1e3fd05a04d4cbea41c1f993", + "is_verified": false, + "line_number": 2206 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "119aea04e3efd1c741bfd98fe51439d6bb280a95", + "is_verified": false, + "line_number": 2207 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "b5c60cd211f3aac2db08a223c0571d1e53e7c60d", + "is_verified": false, + "line_number": 2208 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "4039b99a1c2bdca7737ed4f7934e5a9db2e76f8c", + "is_verified": false, + "line_number": 2209 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "6c04b8e8560c27e7c586a92b046c532da6b1e50c", + "is_verified": false, + "line_number": 2210 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "6a76bf0f171be18b2c3bd53219235c3ab16fdc7f", + "is_verified": false, + "line_number": 2211 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "025bef6ec65b88f3999f1b25157b7a6e17f5bfcd", + "is_verified": false, + "line_number": 2212 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "026954128506e379050cbea083edbddd1c1777b6", + "is_verified": false, + "line_number": 2213 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "745cfb125e37dee46e2952e02a0a4d5d5d56f546", + "is_verified": false, + "line_number": 2314 + }, + { + "type": "Base64 High Entropy String", + "filename": "tutorials/asr/Multilang_ASR.ipynb", + "hashed_secret": "543a58dd6dadfca9bc28a7f164e6b36c0b6e9a96", + "is_verified": false, + "line_number": 4799 + } + ], + "tutorials/multimodal/DreamBooth Tutorial.ipynb": [ + { + "type": "Base64 High Entropy String", + "filename": "tutorials/multimodal/DreamBooth Tutorial.ipynb", + "hashed_secret": "effe1444a4c73d23e5fc2a9f28048e1dd0653e82", + "is_verified": false, + "line_number": 223 + } + ], + "tutorials/multimodal/Multimodal Data Preparation.ipynb": [ + { + "type": "Hex High Entropy String", + "filename": "tutorials/multimodal/Multimodal Data Preparation.ipynb", + "hashed_secret": "5251fc51eb9d18d0de87c87ea09e4af9d1bf7a9f", + "is_verified": false, + "line_number": 18 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/multimodal/Multimodal Data Preparation.ipynb", + "hashed_secret": "194c1dff6224941326fe1d95936ba0e22fd60bb2", + "is_verified": false, + "line_number": 65 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/multimodal/Multimodal Data Preparation.ipynb", + "hashed_secret": "fe852a949d021998ad30bdd6a73a20c82221d486", + "is_verified": false, + "line_number": 217 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/multimodal/Multimodal Data Preparation.ipynb", + "hashed_secret": "b641cbe299c9e27b480cc8a823bb020d45962236", + "is_verified": false, + "line_number": 658 + } + ], + "tutorials/nlp/ITN_with_Thutmose_Tagger.ipynb": [ + { + "type": "Artifactory Credentials", + "filename": "tutorials/nlp/ITN_with_Thutmose_Tagger.ipynb", + "hashed_secret": "b5077fe6f2a92ca029dc6b5c022321b3828a2998", + "is_verified": false, + "line_number": 876 + } + ], + "tutorials/nlp/Token_Classification-BioMegatron.ipynb": [ + { + "type": "Hex High Entropy String", + "filename": "tutorials/nlp/Token_Classification-BioMegatron.ipynb", + "hashed_secret": "308d692d0307f53df800c91720fb271d62078391", + "is_verified": false, + "line_number": 689 + } + ], + "tutorials/speaker_tasks/Speaker_Diarization_Inference.ipynb": [ + { + "type": "Hex High Entropy String", + "filename": "tutorials/speaker_tasks/Speaker_Diarization_Inference.ipynb", + "hashed_secret": "80903ddedcf4ec0a2ee5911cefa7e1ad52419dcc", + "is_verified": false, + "line_number": 990 + } + ], + "tutorials/tools/DefinedCrowd_x_NeMo_ASR_Training_Tutorial.ipynb": [ + { + "type": "Hex High Entropy String", + "filename": "tutorials/tools/DefinedCrowd_x_NeMo_ASR_Training_Tutorial.ipynb", + "hashed_secret": "3d52dd8e15de7d018930a034453752599cecfb95", + "is_verified": false, + "line_number": 18 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/tools/DefinedCrowd_x_NeMo_ASR_Training_Tutorial.ipynb", + "hashed_secret": "8dd2391af4e9a5dc76b28f46ff201e1e7c9942f0", + "is_verified": false, + "line_number": 38 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/tools/DefinedCrowd_x_NeMo_ASR_Training_Tutorial.ipynb", + "hashed_secret": "af149e43b0d4f9e4554b6b7a3260eafbfe1b5d8e", + "is_verified": false, + "line_number": 89 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/tools/DefinedCrowd_x_NeMo_ASR_Training_Tutorial.ipynb", + "hashed_secret": "bb0c7befac27daf54e33d8e8b179598866feae04", + "is_verified": false, + "line_number": 112 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/tools/DefinedCrowd_x_NeMo_ASR_Training_Tutorial.ipynb", + "hashed_secret": "645a085cdd80cde400cc162bfa2c24a286ca24c8", + "is_verified": false, + "line_number": 132 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/tools/DefinedCrowd_x_NeMo_ASR_Training_Tutorial.ipynb", + "hashed_secret": "592340cf9486ccc3b0eff57e8f78ccf1f90add85", + "is_verified": false, + "line_number": 147 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/tools/DefinedCrowd_x_NeMo_ASR_Training_Tutorial.ipynb", + "hashed_secret": "a9fdd91c2d3e03d3a8f039126c275d27c4adc5b2", + "is_verified": false, + "line_number": 198 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/tools/DefinedCrowd_x_NeMo_ASR_Training_Tutorial.ipynb", + "hashed_secret": "eb455e1717efd60ca3896632c94a2b41d87855f2", + "is_verified": false, + "line_number": 212 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/tools/DefinedCrowd_x_NeMo_ASR_Training_Tutorial.ipynb", + "hashed_secret": "096179c125fa827fde3bb88f53873aeaa3f7709f", + "is_verified": false, + "line_number": 263 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/tools/DefinedCrowd_x_NeMo_ASR_Training_Tutorial.ipynb", + "hashed_secret": "9b895d433fc031a41bf872d697038c218e909066", + "is_verified": false, + "line_number": 283 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/tools/DefinedCrowd_x_NeMo_ASR_Training_Tutorial.ipynb", + "hashed_secret": "daf16ebe45194e3ebed5c2cc59f334279d51fa0f", + "is_verified": false, + "line_number": 334 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/tools/DefinedCrowd_x_NeMo_ASR_Training_Tutorial.ipynb", + "hashed_secret": "0d39ffb347d6fcd6c7b3519310756c1020091c6c", + "is_verified": false, + "line_number": 357 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/tools/DefinedCrowd_x_NeMo_ASR_Training_Tutorial.ipynb", + "hashed_secret": "8eedca919f4fb2dafb68c2afc1faf76088ab12e0", + "is_verified": false, + "line_number": 377 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/tools/DefinedCrowd_x_NeMo_ASR_Training_Tutorial.ipynb", + "hashed_secret": "7bc61a4c215f078b7de911363bedd91b471fa213", + "is_verified": false, + "line_number": 392 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/tools/DefinedCrowd_x_NeMo_ASR_Training_Tutorial.ipynb", + "hashed_secret": "3088c565074b06f94684576b96b4d5b59560497c", + "is_verified": false, + "line_number": 443 + }, + { + "type": "Hex High Entropy String", + "filename": "tutorials/tools/DefinedCrowd_x_NeMo_ASR_Training_Tutorial.ipynb", + "hashed_secret": "209b86707a2f8f8253ce09587ca7ac1f6eefd4da", + "is_verified": false, + "line_number": 457 + } + ], + "tutorials/tts/FastPitch_Finetuning.ipynb": [ + { + "type": "Hex High Entropy String", + "filename": "tutorials/tts/FastPitch_Finetuning.ipynb", + "hashed_secret": "e915298ac5414db160aada21c7a235431ddfa98d", + "is_verified": false, + "line_number": 717 + } + ], + "tutorials/tts/FastPitch_MixerTTS_Training.ipynb": [ + { + "type": "Hex High Entropy String", + "filename": "tutorials/tts/FastPitch_MixerTTS_Training.ipynb", + "hashed_secret": "e915298ac5414db160aada21c7a235431ddfa98d", + "is_verified": false, + "line_number": 611 + } + ], + "tutorials/tts/Inference_ModelSelect.ipynb": [ + { + "type": "Hex High Entropy String", + "filename": "tutorials/tts/Inference_ModelSelect.ipynb", + "hashed_secret": "98307baca81149afa8a07a7cbe7ebc48c447d4be", + "is_verified": false, + "line_number": 315 + } + ], + "tutorials/tts/NeMo_TTS_Primer.ipynb": [ + { + "type": "Hex High Entropy String", + "filename": "tutorials/tts/NeMo_TTS_Primer.ipynb", + "hashed_secret": "e915298ac5414db160aada21c7a235431ddfa98d", + "is_verified": false, + "line_number": 2063 + } + ] + }, + "generated_at": "2024-11-14T09:37:19Z" +} diff --git a/western_ai/canada/nemo/AGENTS.md b/western_ai/canada/nemo/AGENTS.md new file mode 100644 index 0000000000000000000000000000000000000000..681311eb9cf453d0faddf3aacaec7357e97ba8e9 --- /dev/null +++ b/western_ai/canada/nemo/AGENTS.md @@ -0,0 +1 @@ +CLAUDE.md \ No newline at end of file diff --git a/western_ai/canada/nemo/CITATION.cff b/western_ai/canada/nemo/CITATION.cff new file mode 100644 index 0000000000000000000000000000000000000000..d281c197bd66a362f03aa3b418f8510b132a0014 --- /dev/null +++ b/western_ai/canada/nemo/CITATION.cff @@ -0,0 +1,41 @@ +cff-version: 1.2.0 +message: "If you use this software, please cite it as below." +title: "NeMo: a toolkit for Conversational AI and Large Language Models" +url: https://nvidia.github.io/NeMo/ +repository-code: https://github.com/NVIDIA/NeMo +authors: + - family-names: Harper + given-names: Eric + - family-names: Majumdar + given-names: Somshubra + - family-names: Kuchaiev + given-names: Oleksii + - family-names: Jason + given-names: Li + - family-names: Zhang + given-names: Yang + - family-names: Bakhturina + given-names: Evelina + - family-names: Noroozi + given-names: Vahid + - family-names: Subramanian + given-names: Sandeep + - family-names: Nithin + given-names: Koluguri + - family-names: Jocelyn + given-names: Huang + - family-names: Jia + given-names: Fei + - family-names: Balam + given-names: Jagadeesh + - family-names: Yang + given-names: Xuesong + - family-names: Livne + given-names: Micha + - family-names: Dong + given-names: Yi + - family-names: Naren + given-names: Sean + - family-names: Ginsburg + given-names: Boris + diff --git a/western_ai/canada/nemo/CLAUDE.md b/western_ai/canada/nemo/CLAUDE.md new file mode 100644 index 0000000000000000000000000000000000000000..651516ab49bf4f9b8ec0c45f3c259d811026fd02 --- /dev/null +++ b/western_ai/canada/nemo/CLAUDE.md @@ -0,0 +1,108 @@ +# CLAUDE.md / AGENTS.md + +This file provides guidance when working with code in this repository. + +## Project Overview + +NeMo Speech — toolkit for training/deploying speech models (ASR, TTS, Speech LLM). Active collections: `asr`, `tts`, `audio`, `speechlm2`, `common`. No Megatron / Megatron Core / Transformer Engine — parallelism is PyTorch-native (DDP, FSDP2, TP/SP via DTensor). + +## Build & Install + +See the canonical installation guide — [`docs/source/starthere/install.rst`](docs/source/starthere/install.rst) (published at https://docs.nvidia.com/nemo/speech/nightly/) — for the uv, pip (bring-your-own Python/PyTorch/CUDA), Docker, and optional `compiled` (SpeechLM2/Automodel) install paths. + +Dev quickstart: `uv sync --extra all --extra cu13` (Python 3.12+, PyTorch 2.7+; `test`/`docs` are `--group`s, not extras). + +## Code Style + +- **Line length: 119** (not default 88) — consistent across black, isort, flake8 +- Black with `skip_string_normalization = true` +- isort with `profile = black` +- Check: `isort --check && black --check ` or `isort --check . && black --check .` +- Fix: `isort && black ` or `isort . && black .` +- Jupyter Notebooks are excluded from automatic black reformatting (see `extend-exclude`), but can be still reformatted when passed directly. Do not reformat notebooks outside your changes. + +## Testing + +```bash +pytest tests/collections/asr -m "not pleasefixme" -v # ASR tests, skip broken +pytest tests/collections/tts -m unit -v # TTS unit tests +pytest -k "test_name" tests/ # Single test by name +``` + +Markers: `unit`, `integration`, `system`, `pleasefixme` (broken — skip), `skipduringci`. + +## CI & PRs + +- NVIDIA developers: feature branches off `main`; community: fork-based workflow +- CI triggered by adding **"Run CICD"** label to the PR +- E2E nightly tests: only when really needed. Add both **"Run e2e nightly"** and **"Run CICD"** labels +- `skip-linting` / `skip-docs` labels bypass those checks +- Formatting CI auto-commits black/isort fixes back to the PR branch +- CI: GitHub Actions in `.github/workflows/` + +## Documentation + +Sphinx-based docs live in `docs/source/`. Build with: + +```bash +uv sync --locked --group docs # one-time setup (matches CI) +uv run make -C docs clean html # full rebuild +uv run make -C docs html # incremental rebuild +``` + +Output goes to `docs/build/html/`. Open `docs/build/html/index.html` to preview locally. + +Other useful targets: `make -C docs linkcheck` (verify external links), `make -C docs doctest` (run embedded doctests). + +## Training & Inference + +Entry-point scripts live under `examples//`. + +All scripts follow the same Hydra pattern — a `@hydra_runner` decorator points to a YAML config in a nearby `conf/` directory: + +```python +@hydra_runner(config_path="conf", config_name="fast-conformer_transducer_bpe") +def main(cfg): + trainer = pl.Trainer(**resolve_trainer_cfg(cfg.trainer)) + exp_manager(trainer, cfg.get("exp_manager", None)) + model = EncDecRNNTBPEModel(cfg=cfg.model, trainer=trainer) + trainer.fit(model) +``` + +Override any config value from the CLI with Hydra syntax: `python script.py model.optim.lr=1e-4 trainer.max_epochs=50`. Browse configs with `ls examples//conf/` to see which models and variants are supported. + +## Handy Scripts + +Utility scripts live under `scripts/`. Key subdirectories: `speech_recognition/`, `speechlm2/`, `speaker_tasks/`, `tokenizers/`, `dataset_processing/`, `asr_language_modeling/`. Browse with `ls scripts/`. + +Four frequently used data/training helpers: + +- **`scripts/speech_recognition/estimate_duration_bins.py`** — estimate Lhotse dynamic-bucketing duration bins from a manifest or YAML input config. Usage: `python scripts/speech_recognition/estimate_duration_bins.py -b 30 -n 100000` +- **`scripts/speech_recognition/oomptimizer.py`** — find the largest batch size per bucket that fits in GPU memory. Usage: `python scripts/speech_recognition/oomptimizer.py --pretrained-name nvidia/canary-1b` or point to a config with `--config-path`. +- **`scripts/speech_recognition/estimate_data_weights.py`** — compute per-dataset sampling weights from YAML input configs, with optional temperature re-weighting. Usage: `python scripts/speech_recognition/estimate_data_weights.py input.yaml output.yaml -t 0.5` +- **`scripts/speech_recognition/convert_to_tarred_audio_dataset.py`** — shard audio+manifest into tar files. Usage: `python scripts/speech_recognition/convert_to_tarred_audio_dataset.py --manifest_path=m.json --target_dir=./tar --num_shards=512 --max_duration=60.0` + +## Architecture + +- **Hydra + OmegaConf** for all config management (YAML configs) +- **PyTorch Lightning** for training orchestration +- **Lhotse** (>=1.32.2) for audio data loading +- Collections are semi-isolated domains sharing `nemo.core` and `nemo.collections.common` + +## Subdirectory Instructions + +Module-specific instructions can be added as `CLAUDE.md` or `AGENTS.md` files in subdirectories. + +## Issue Reproduction + +When fixing a bug, always: +1. First reproduce the issue with a minimal test case +2. Add the reproduction as a unit test +3. Then fix the issue +4. Verify the test passes + +## Forbidden Operations + +- Never push directly to `main` +- Never modify `.github/workflows/` without explicit instruction +- Never delete test files without explicit instruction diff --git a/western_ai/canada/nemo/CONTRIBUTING.md b/western_ai/canada/nemo/CONTRIBUTING.md new file mode 100644 index 0000000000000000000000000000000000000000..e99e19374626902b9623aee229aaed7363af0bcc --- /dev/null +++ b/western_ai/canada/nemo/CONTRIBUTING.md @@ -0,0 +1,104 @@ +# Contributions are welcome! + +We do all of NeMo's development in the open. Contributions from NeMo community are welcome. + + +# Pull Requests (PR) Guidelines + +**Send your PRs to the `main` branch** + +1) Make sure your PR does one thing. Have a clear answer to "What does this PR do?". +2) Read General Principles and style guide below +3) Make sure you sign your commits. E.g. use ``git commit -s`` when before your commit +4) Make sure relevant unittests finish successfully before sending PR +5) Send your PR and request a review + +## Unit tests +Quick tests (locally, while developing) +``` +pytest +# If you don't have NVIDIA GPU do: +# pytest -m "not pleasefixme" --cpu path/to/relevant_tests +``` +Full tests, including pre-trained model downloads +``` +pytest -m "not pleasefixme" --with_downloads path/to/relevant_tests +``` + +Replace `path/to/relevant_tests` with the test directory to run such as `tests/collections/asr`. Check the test scripts in `tests/functional_tests` +that begin with `L0_Unit_Tests_` for the specific test configuration used by different parts of the unit test suite. Different suites may expect +different environment variables to be set. + +## Running the Github CI + +CI is powered by [copy-pr-bot](https://github.com/apps/copy-pr-bot), which mirrors each PR to a `pull-request/` branch and triggers the workflow on push. + +**CI runs automatically** when all of the following are true: +- Every commit in the PR is [GPG-signed](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification) +- Every committer is a member of the NVIDIA-NeMo GitHub org (or listed as an `additional_trustee`) +- The PR has no more than 249 commits + +If any of those conditions are not met, copy-pr-bot posts a comment and skips branch creation — CI will not run. A maintainer (anyone with write access or greater) can trigger it manually by commenting: +``` +/ok to test +``` +where `` is the full or abbreviated SHA of the PR's HEAD commit. The bot also accepts `/okay to test` and `/ok-to-test`. + +To re-run CI after a new push, the bot will sync automatically if the PR is still trusted. Otherwise comment `/ok to test ` again with the new HEAD SHA. + +The CI test suites are selectively ran based on the files that are changed. In some cases, no tests may be ran such as when docs are updated. + +Lint checks using flake8 and pylint are ran on the code based on the files that were changed. Please resolve any lint errors. It is possible but discouraged +to ignore the lint errors by adding the "skip-linting" label to the PR. + +To run the nightly e2e test suite on a PR, add the "Run e2e nightly" label. Labels are read once by the `pre-flight` job at the start of each run, so the label must be present before CI starts. If CI is already running when you add the label, cancel the active workflow run and re-trigger by pushing a new commit. + +## Whom should you ask for review: +Please tag @nithinraok for NeMo core and ASR related PRs and @blisc for TTS related PRs. + +Note that some people may self-assign to review your PR - in which case, please wait for them to add a review. + +Your pull requests must pass all checks and peer-review before they can be merged. + +# General principles +1. **User-oriented**: make it easy for end users, even at the cost of writing more code in the background +1. **Robust**: make it hard for users to make mistakes. +1. **Well-tested**: please add simple, fast unittests. Consider adding CI tests for end-to-end functionality. +1. **Reusable**: for every piece of code, think about how it can be reused in the future and make it easy to be reused. +1. **Readable**: code should be easier to read. +1. **Legal**: if you copy even one line of code from the Internet, make sure that the code allows the license that NeMo supports. Give credit and link back to the code. +1. **Sensible**: code should make sense. If you think a piece of code might be confusing, write comments. + +## Class naming conventions +* No “I”, “Interface”, “NM” nor “NeMo” pre/postfixes anywhere +* Core interfaces have simple names: Typing, Cloud, Serialization, FileIO* +* Core classes have the simplest names ever: NeuralModule, Model, Graph, Dataset, Loss, Module* +* Abstract classes in the Model hierarchy have Model postfix +* A config class for MyModel should be called MyModelConfig +* Leaf Neural Module classes have simple names without any postfixes (e.g. AudioPreprocess) +* Leaf Datasets have Dataset postfix (e.g. AudioToSpeechLabelDataset) +* Leaf Losses have Loss postfix (e.g. CTCLoss) +* Leaf Models do not have any postfix, just name (e.g. QuartzNet) + +## Python style +We use ``black`` as our style guide. To check whether your code will pass style check (from the NeMo's repo folder) run: +``python setup.py style --scope path/to/changed/files`` and if it does not pass run ``python setup.py style --scope path/to/changed/files --fix``. + +1. Include docstrings for every class and method exposed to the user. +1. Use Python 3 type hints for every class and method exposed to the user. +1. Avoid wild import: ``from X import *`` unless in ``X.py``, ``__all__`` is defined. +1. Minimize the use of ``**kwargs``. +1. ``RaiseError`` is preferred to ``assert``. Write: ```if X: raise Error``` instead of ```assert X```. +1. Classes are preferred to standalone methods. +1. Methods should be atomic. A method shouldn't be longer than 75 lines, e.g. can be fit into the computer screen without scrolling. +1. If a method has arguments that don't fit into one line, each argument should be in its own line for readability. +1. Add ``__init__.py`` for every folder. +1. F-strings are prefered to formatted strings. +1. Loggers are preferred to print. In NeMo, you can use logger from ``from nemo.utils import logging`` +1. Private functions (functions start with ``_``) shouldn't be called outside its host file. +1. If a comment lasts multiple lines, use ``'''`` instead of ``#``. + +# Collections +Collection is a logical grouping of related Neural Modules. It is a grouping of modules that share a domain area or semantics. +When contributing module to a collection, please make sure it belongs to that category. +If you would like to start a new one and contribute back to the platform, you are very welcome to do so. diff --git a/western_ai/canada/nemo/codecov.yml b/western_ai/canada/nemo/codecov.yml new file mode 100644 index 0000000000000000000000000000000000000000..c0eb7d6eedb03542e38795f1ade8820b2cfc36a9 --- /dev/null +++ b/western_ai/canada/nemo/codecov.yml @@ -0,0 +1,23 @@ +comment: false +coverage: + status: + project: false + patch: + default: + target: 80% + threshold: 0% + base: auto + if_ci_failed: error + paths: + - "!nemo/collections/asr" + - "!nemo/collections/audio" + - "!nemo/collections/speechlm" + - "!nemo/collections/tts" + - "!nemo/core" + - "!nemo/collections/common" + - "!nemo/collections/multimodal_autoregressive" + - "!nemo/collections/diffusion" + - "!nemo/collections/nlp" + +fixes: + - "/workspace/::" diff --git a/western_ai/canada/nemo/docker/Dockerfile b/western_ai/canada/nemo/docker/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..5c99bf5edb7126546b3cbe6b045b1b7ef245c5a4 --- /dev/null +++ b/western_ai/canada/nemo/docker/Dockerfile @@ -0,0 +1,297 @@ +# syntax=docker/dockerfile:1-labs + +# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This CI Dockerfile supports CUDA 13 and CUDA 12 from a single BASE_IMAGE +# build arg. The default is the recommended CUDA 13 image: +# nvcr.io/nvidia/cuda-dl-base:26.04-cuda13.2-devel-ubuntu24.04 +# The current recommended CUDA 12 image is: +# nvcr.io/nvidia/cuda-dl-base:25.06-cuda12.9-devel-ubuntu24.04 +# +# The build derives CUDA_FLAVOR internally from BASE_IMAGE by matching +# "cuda13" or "cuda12" in the image tag. That flavor selects the matching uv +# extra (cu13 or cu12) and CUDA Python package include path. If BASE_IMAGE does +# not contain either token, the build fails early. +# +# Example CUDA 13 H100+ build: +# docker buildx build -f docker/Dockerfile \ +# --build-arg GPU_TARGET=h100plus . +# Example CUDA 12 A100 build: +# docker buildx build -f docker/Dockerfile \ +# --build-arg BASE_IMAGE=nvcr.io/nvidia/cuda-dl-base:25.06-cuda12.9-devel-ubuntu24.04 \ +# --build-arg GPU_TARGET=a100 . +# +# GPU_TARGET controls compiled Automodel dependency tuning. "h100plus" builds +# for SM90/SM100/SM120 and includes H100+ features such as DeepEP and +# flash-attn-4. "a100" builds only SM80 and uses an A100-specific DeepEP patch +# to avoid unsupported newer-GPU/NVSHMEM build paths. This keeps CI images +# smaller and avoids compiling kernels for architectures a target image cannot +# use. +ARG BASE_IMAGE=nvcr.io/nvidia/cuda-dl-base:26.04-cuda13.2-devel-ubuntu24.04 +FROM ${BASE_IMAGE} AS base-image +ARG BASE_IMAGE +ARG UV_VERSION=0.11.14 + +ENV DEBIAN_FRONTEND=noninteractive +ENV TRANSFORMERS_OFFLINE=0 +ENV HYDRA_FULL_ERROR=1 +ENV PYTHONUNBUFFERED=1 +ENV UV_PYTHON=3.13 +ENV UV_PROJECT_ENVIRONMENT=/opt/venv +ENV UV_LINK_MODE=copy +ENV UV_NO_CACHE=1 +ENV UV_NO_PROGRESS=1 +ENV VIRTUAL_ENV=/opt/venv +ENV PATH="/root/.local/bin:${VIRTUAL_ENV}/bin:${PATH}" + +RUN <<"EOF" bash -ex +apt-get update +apt-get install -y \ + curl \ + git \ + libsox3 +apt-get clean +EOF +# NOTE: removed libsndfile1 and only kept libsox3 +# soundfile ships with its own version of libsndfile1 +# lhotse only links into libsox3 and not the rest of sox; removed sox and libsox-fmt-all and only kept libsox3 + +RUN <<"EOF" bash -ex +curl -LsSf "https://astral.sh/uv/${UV_VERSION}/install.sh" | sh +uv --version +EOF + +RUN <<"EOF" bash -euxo pipefail +case "${BASE_IMAGE}" in + *cuda12*) cuda_flavor=cu12 ;; + *cuda13*) cuda_flavor=cu13 ;; + *) + echo "Cannot derive CUDA flavor from BASE_IMAGE='${BASE_IMAGE}'. Expected image tag containing 'cuda12' or 'cuda13'." + exit 1 + ;; +esac +cuda_major_minor="$(sed -n 's/.*cuda\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/p' <<<"${BASE_IMAGE}")" +if [[ -z "${cuda_major_minor}" ]]; then + echo "Cannot derive CUDA major.minor from BASE_IMAGE='${BASE_IMAGE}'. Expected image tag containing e.g. 'cuda12.9' or 'cuda13.2'." + exit 1 +fi +cat >/usr/local/bin/nemo-cuda-flavor < + """ + }, + "extra_footer": { + """ + + """ + }, +} +html_extra_path = ["project.json", "versions1.json"] + +# OpenGraph settings +ogp_site_url = 'https://nvidia.github.io/NeMo/' +ogp_image = 'https://docs.nvidia.com/deeplearning/nemo/user-guide/docs/en/main/_static/nv_logo.png' + +# MathJax CDN +# follow recommendation here https://www.sphinx-doc.org/en/master/usage/extensions/math.html#module-sphinx.ext.mathjax +mathjax_path = "https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS-MML_HTMLorMML" diff --git a/western_ai/canada/nemo/docs/source/core/adapters/adapter_bib.bib b/western_ai/canada/nemo/docs/source/core/adapters/adapter_bib.bib new file mode 100644 index 0000000000000000000000000000000000000000..aa38494a996b1307c5f5aeb0e7ed82cf77c3f745 --- /dev/null +++ b/western_ai/canada/nemo/docs/source/core/adapters/adapter_bib.bib @@ -0,0 +1,21 @@ + + +@inproceedings{houlsby2019adapter, + title={Parameter-efficient transfer learning for NLP}, + author={Houlsby, Neil and Giurgiu, Andrei and Jastrzebski, Stanislaw and Morrone, Bruna and De Laroussilhe, Quentin and Gesmundo, Andrea and Attariyan, Mona and Gelly, Sylvain}, + booktitle={International Conference on Machine Learning}, + pages={2790--2799}, + year={2019}, + organization={PMLR} +} + +@misc{Junxian2021unified, + doi = {10.48550/ARXIV.2110.04366}, + url = {https://arxiv.org/abs/2110.04366}, + author = {He, Junxian and Zhou, Chunting and Ma, Xuezhe and Berg-Kirkpatrick, Taylor and Neubig, Graham}, + keywords = {Computation and Language (cs.CL), Machine Learning (cs.LG), FOS: Computer and information sciences, FOS: Computer and information sciences}, + title = {Towards a Unified View of Parameter-Efficient Transfer Learning}, + publisher = {arXiv}, + year = {2021}, + copyright = {arXiv.org perpetual, non-exclusive license} +} diff --git a/western_ai/canada/nemo/docs/source/core/adapters/api.rst b/western_ai/canada/nemo/docs/source/core/adapters/api.rst new file mode 100644 index 0000000000000000000000000000000000000000..99ac3ff5dbe63e03603e55eb6d106cd391ede6ea --- /dev/null +++ b/western_ai/canada/nemo/docs/source/core/adapters/api.rst @@ -0,0 +1,66 @@ +Adapters API +============ + +Core +---- + +.. autoclass:: nemo.core.adapter_mixins.AdapterModuleMixin + :show-inheritance: + :members: + :member-order: bysource + :undoc-members: adapter_module_names + :noindex: + + +.. autoclass:: nemo.core.adapter_mixins.AdapterModelPTMixin + :show-inheritance: + :members: + :member-order: bysource + :undoc-members: adapter_module_names + :noindex: + + +Adapter Networks +---------------- + + +.. autoclass:: nemo.collections.common.parts.adapter_modules.AdapterModuleUtil + :show-inheritance: + :members: + :member-order: bysource + :noindex: + + +.. autoclass:: nemo.collections.common.parts.adapter_modules.LinearAdapter + :show-inheritance: + :members: + :member-order: bysource + :noindex: + + +Adapter Strategies +------------------ + + +.. autoclass:: nemo.core.classes.mixins.adapter_mixin_strategies.AbstractAdapterStrategy + :show-inheritance: + :members: + :member-order: bysource + :undoc-members: adapter_module_names + :noindex: + + +.. autoclass:: nemo.core.classes.mixins.adapter_mixin_strategies.ReturnResultAdapterStrategy + :show-inheritance: + :members: + :member-order: bysource + :undoc-members: adapter_module_names + :noindex: + + +.. autoclass:: nemo.core.classes.mixins.adapter_mixin_strategies.ResidualAddAdapterStrategy + :show-inheritance: + :members: + :member-order: bysource + :undoc-members: adapter_module_names + :noindex: diff --git a/western_ai/canada/nemo/docs/source/core/adapters/components.rst b/western_ai/canada/nemo/docs/source/core/adapters/components.rst new file mode 100644 index 0000000000000000000000000000000000000000..b9cdab3a9fa49f7a53a2108e80c2c4c26aac6df2 --- /dev/null +++ b/western_ai/canada/nemo/docs/source/core/adapters/components.rst @@ -0,0 +1,94 @@ +Adapter Components +================== + +Adapters can be considered as any set of parameters that are added to a pre-existing module/model. In our case, we currently support the standard adapter in literature, more advanced adapter modules are being researched and can potentially be supported by NeMo. + +An adapter module can be any pytorch module, but it must follow certain straightforward requirements - + +1) The model accepts an input of some input dimension, and its output must match this dimension. +2) Ideally, the module is initialized such that the output of the adapter when initialized is such that it does not modify the original input. This allows the model to produce the same output results, even when additional parameters have been added. + +According to Junxian et al :cite:`adapters-components-Junxian2021unified`, we can consider an adapter being represented as three components - + +1) Functional form - the trainable parameters that will modify the input +2) Insertion form - Where the adapter outputs are integrated with the original input. The input to the adapters can be the last output of the layer, the input to some attention layer, or even the original input to the module itself (before even the modules forward pass). +3) Composition function - How the adapters outputs are integrated with the inputs. It can be as simple as residual addition connection, or concatenation, or point-wise multiplication etc. + +Functional Form - Adapter Networks +================================== + +Adapter modules represent the functional form of the adapter. We discuss an example of a most commonly used adapter module found in literature, titled the ``LinearAdapter`` (or Houlsby Adapter) :cite:`adapters-components-houlsby2019adapter`. + +.. note:: + + All adapter modules must extend :class:`~nemo.collections.common.parts.adapter_modules.AdapterModuleUtil` and should ideally have an equivalent DataClass config for easy instantiation ! + + +.. autoclass:: nemo.collections.common.parts.adapter_modules.AdapterModuleUtil + :show-inheritance: + :members: + :member-order: bysource + :noindex: + +----- + +.. autoclass:: nemo.collections.common.parts.adapter_modules.LinearAdapter + :show-inheritance: + :members: + :member-order: bysource + :noindex: + + +Insertion Form - Module Adapters +-------------------------------- + +Adapter modules can be integrated into many different locations of a given module. For example, it is possible to have an adapter that affects only the outputs of the final layer in each module. We can also have a ``Parallel Adapter`` :cite:`adapters-components-Junxian2021unified` that operates at the input of the module itself, in parallel to the forward pass of the module. Yet another insertion location is inside the Multi Head Attention Layers. + +On top of this, while adapters are commonly used only in the layers containing the most parameters (say the Encoder of a network), some models can support adapters in multiple locations (Encoder-Decoder architecture for Language Models, Machine Translation, or even Encoder-Decoder-Joint for ASR with Transducer Loss). As such, NeMo utilizes the concept of ``Module Adapters``. + +``Module Adapters`` are very simply defined when adding an adapter - by specifying the module that the adapter should be inserted into. + +.. code-block:: python + + # Get the list of supported modules / locations in a adapter compatible Model + print(model.adapter_module_names) # assume ['', 'encoder', 'decoder'] + + # When calling add_adapter, specify the module name in the left of the colon symbol, and the adapter name afterwords. + # The adapter is then directed to the decoder module instead of the default / encoder module. + model.add_adapter("decoder:first_adapter", cfg=...) + +You might note that ``model.adapter_module_names`` can sometimes return ``''`` as one of the supported module names - this refers to the "default module". Generally we try to provide the default as the most commonly used adapter in literature - for example, Encoder adapters in NLP/NMT/ASR. + +Composition Function - Adapter Strategies +----------------------------------------- + +Finally, we discuss how to compose the input and output of adapter modules. In order to generalize this step, we construct ``Adapter Strategies``. +A strategy is any class (not torch.nn.Module!) that extends :class:`~nemo.core.classes.mixins.adapter_mixin_strategies.AbstractAdapterStrategy`, and provides a ``forward()`` method that accepts a specific signature of the inputs and produces an output tensor which combines the input and output with some specific method. + +We discuss a simple residual additional connection strategy below - that accepts an input to the adapter and an adapters output and simply adds them together. It also supports ``stochastic_depth`` which enables adapters to be dynamically switched off during training, making training more robust. + +.. autoclass:: nemo.core.classes.mixins.adapter_mixin_strategies.AbstractAdapterStrategy + :show-inheritance: + :members: + :member-order: bysource + :undoc-members: adapter_module_names + :noindex: + +----- + +.. autoclass:: nemo.core.classes.mixins.adapter_mixin_strategies.ResidualAddAdapterStrategy + :show-inheritance: + :members: + :member-order: bysource + :undoc-members: adapter_module_names + :noindex: + +----- + + +References +---------- + +.. bibliography:: ./adapter_bib.bib + :style: plain + :keyprefix: adapters-components- diff --git a/western_ai/canada/nemo/docs/source/core/adapters/intro.rst b/western_ai/canada/nemo/docs/source/core/adapters/intro.rst new file mode 100644 index 0000000000000000000000000000000000000000..87d3e1d46373ce0aef114e43cd58a31578e713a7 --- /dev/null +++ b/western_ai/canada/nemo/docs/source/core/adapters/intro.rst @@ -0,0 +1,149 @@ +Adapters +======== + +In NeMo, we often train models and fine-tune them for a specific task. This is a reasonable approach when the models are just a few million parameters. However, this approach quickly becomes infeasible when approaching hundreds of millions or even billions of parameters. As a potential solution to such a scenario, where fine-tuning a massive model is no longer feasible, we look to `Adapters `_ :cite:`adapters-houlsby2019adapter` to specialize our model on a specific domain or task. Adapters require a fraction of the total number of parameters as the original model and are much more efficient to fine-tune. + +.. note:: + + For a detailed tutorial on adding ``Adapter`` support to any PyTorch module, please refer to the NeMo Adapter :doc:`Tutorials <../../starthere/tutorials>`. + + +What are Adapters? +------------------ + +Adapters are a straightforward concept - one formulation can be shown by the diagram below. At their simplest, they are residual Feedforward layers that compress the input dimension (:math:`D`) to a small bottleneck dimension (:math:`H`), such that :math:`R^D \text{->} R^H`, compute an activation (such as ReLU), finally mapping :math:`R^H \text{->} R^D` with another Feedforward layer. This output is then added to the input via a simple residual connection. + +.. raw:: html + +
+ +
+ +Adapter modules such as this are usually initialized such that the initial output of the adapter will always be zeros so as to prevent degradation of the original model's performance due to addition of such modules. + +``torch.nn.Module`` with Adapters +--------------------------------- + +In NeMo, Adapters are supported via a ``Mixin`` class that can be attached to any ``torch.nn.Module``. Such a module will +have multiple additional methods which will enable adapter capabilities in that module. + +.. code-block:: python + + # Import the adapter mixin from NeMo + from nemo.core import adapter_mixins + + # NOTE: See the *two* classes being inherited here ! + class MyModule(torch.nn.Module, adapter_mixins.AdapterModuleMixin): + pass + + +AdapterModuleMixin +------------------ +Let's look into what :class:`~nemo.core.adapter_mixins.AdapterModuleMixin` adds to the general PyTorch module. Some of the most important methods that are required are listed below : + +1) ``add_adapter``: Used to add an adapter with a unique name to the module. +2) ``get_enabled_adapters``: Returns a list of names of all enabled adapter modules. +3) ``set_enabled_adapters``: Sets whether a single (or all) adapters are enabled or disabled. +4) ``is_adapter_available``: Check if any adapter is available and enabled or not. + +Modules that extend this mixin usually can directly use these methods without extending them, but we will cover a case below +where you may wish to extend these methods. + +.. autoclass:: nemo.core.adapter_mixins.AdapterModuleMixin + :show-inheritance: + :members: + :member-order: bysource + :undoc-members: adapter_module_names + + +Using the Adapter Module +------------------------ + +Now that ``MyModule`` supports adapters, we can easily add adapters, set their state, check if they are available and +perform their forward pass. Note that if multiple adapters are enabled, they are called in a chain, the output of the previous adapter is passed as input to the next adapter and so on. + +.. code-block:: python + + # Import the adapter mixin and modules from NeMo + import torch + from nemo.core import adapter_mixins + from nemo.collections.common.parts import adapter_modules + + class MyModule(torch.nn.Module, adapter_mixins.AdapterModuleMixin): + + def forward(self, x: torch.Tensor) -> torch.Tensor: + output = self.layers(x) # assume self.layers is some Sequential() module + + if self.is_adapter_available(): # check if adapters were added or not + output = self.forward_enabled_adapters() # perform the forward of all enabled adapters in a chain + + return output + + # Now let us create a module, add an adapter and do a forward pass with some random inputs + module = MyModule(dim) # assume dim is some input and output dimension of the module. + + # Add an adapter + module.add_adapter("first_adapter", cfg=adapter_modules.LinearAdapter(in_features=dim, dim=5)) + + # Check if adapter is available + module.is_adapter_available() # returns True + + # Check the name(s) of the enabled adapters + module.get_enabled_adapters() # returns ['first_adapter'] + + # Set the state of the adapter (by name) + module.set_enabled_adapters(name="first_adapter", enabled=True) + + # Freeze all the weights of the original module (equivalent to calling module.freeze() for a NeuralModule) + for param in module.parameters(): + param.requires_grad = False + + # Unfreeze only the adapter weights (so that we finetune only the adapters and not the original weights !) + module.unfreeze_enabled_adapters() + + # Now you can train this model's adapters ! + input_data = torch.randn(4, dim) # assume dim is the input-output dim of the module + outputs_with_adapter = module(input_data) + + # Compute loss and backward ... + + +Adapter Compatible Models +------------------------- + +If the goal was to support adapters in a single module, then the goal has been accomplished. In the real world however, we +build large composite models out of multiple modules and combine them to build a final model that we then train. We do this using the +:class:`~nemo.core.adapter_mixins.AdapterModelPTMixin`. + +.. note:: + + For an in-depth guide to supporting hierarchical adapter modules, please refer to the NeMo Adapter :doc:`Tutorials <../../starthere/tutorials>`. + + +.. autoclass:: nemo.core.adapter_mixins.AdapterModelPTMixin + :show-inheritance: + :members: + :member-order: bysource + :undoc-members: adapter_module_names + +Below, we will discuss some useful functionality of Adapter Compatible Models. + +1) ``Save and restore a Model with adapter capability``: Any NeMo model that implements this class correctly can save and restore NeMo models with adapter capabilities, thereby allowing sharing of adapters. +2) ``save_adapters`` and ``load_adapters``: Adapters are usually a very small number of parameters, there is no need for the entire model to be duplicated for each adapter. This method allows storing just the adapter module(s) separately from the Model, so that you can use the same "base" model, and share just the Adapter modules. + + +.. toctree:: + :maxdepth: 8 + :caption: Adapters + + components + api + + +References +---------- + +.. bibliography:: ./adapter_bib.bib + :style: plain + :labelprefix: adapters + :keyprefix: adapters- diff --git a/western_ai/canada/nemo/docs/source/core/api.rst b/western_ai/canada/nemo/docs/source/core/api.rst new file mode 100644 index 0000000000000000000000000000000000000000..618dcc8d4a114811640ec6330903bbf2b630bec3 --- /dev/null +++ b/western_ai/canada/nemo/docs/source/core/api.rst @@ -0,0 +1,130 @@ + +NeMo Core APIs +============== + +Base class for all NeMo models +------------------------------ + +.. autoclass:: nemo.core.ModelPT + :show-inheritance: + :members: + :member-order: bysource + :undoc-members: cfg, num_weights + :exclude-members: set_eff_save, use_eff_save, teardown + +Base Neural Module class +------------------------ + +.. autoclass:: nemo.core.NeuralModule + :show-inheritance: + :members: + :member-order: bysource + +Base Mixin classes +------------------ + +.. autoclass:: nemo.core.Typing + :show-inheritance: + :members: + :member-order: bysource + :private-members: + :exclude-members: _abc_impl + :noindex: + + +.. autoclass:: nemo.core.Serialization + :show-inheritance: + :members: + :member-order: bysource + :noindex: + + +.. autoclass:: nemo.core.FileIO + :show-inheritance: + :members: + :member-order: bysource + :noindex: + + +Base Connector classes +---------------------- + +.. autoclass:: nemo.core.connectors.save_restore_connector.SaveRestoreConnector + :show-inheritance: + :members: + :member-order: bysource + + +Base Mixin Classes +------------------ + +.. autoclass:: nemo.core.classes.mixins.access_mixins.AccessMixin + :show-inheritance: + :members: + :member-order: bysource + + +.. autoclass:: nemo.core.classes.mixins.hf_io_mixin.HuggingFaceFileIO + :show-inheritance: + :members: + :member-order: bysource + + +Neural Type checking +-------------------- + +.. autoclass:: nemo.core.classes.common.typecheck + :show-inheritance: + :members: + :member-order: bysource + + .. automethod:: __call__ + +Neural Type classes +------------------- + +.. autoclass:: nemo.core.neural_types.NeuralType + :show-inheritance: + :members: + :member-order: bysource + + +.. autoclass:: nemo.core.neural_types.axes.AxisType + :show-inheritance: + :members: + :member-order: bysource + + +.. autoclass:: nemo.core.neural_types.elements.ElementType + :show-inheritance: + :members: + :member-order: bysource + + +.. autoclass:: nemo.core.neural_types.comparison.NeuralTypeComparisonResult + :show-inheritance: + :members: + :member-order: bysource + +Experiment manager +------------------ + +.. autoclass:: nemo.utils.exp_manager.exp_manager + :show-inheritance: + :members: + :member-order: bysource + +.. autoclass:: nemo.utils.exp_manager.ExpManagerConfig + :show-inheritance: + :members: + :member-order: bysource + + +Exportable +---------- + +.. autoclass:: nemo.core.classes.exportable.Exportable + :show-inheritance: + :members: + :member-order: bysource + diff --git a/western_ai/canada/nemo/docs/source/core/core.rst b/western_ai/canada/nemo/docs/source/core/core.rst new file mode 100644 index 0000000000000000000000000000000000000000..ae25843d9fcc9e3d740a4f6d4ffb1bf8190cfb79 --- /dev/null +++ b/western_ai/canada/nemo/docs/source/core/core.rst @@ -0,0 +1,777 @@ +NeMo Models +=========== + +Basics +------ + +NeMo models contain everything needed to train and reproduce conversational AI models: + +- neural network architectures +- datasets/data loaders +- data preprocessing/postprocessing +- data augmentors +- optimizers and schedulers +- tokenizers +- language models + +NeMo uses `Hydra `_ for configuring both NeMo models and the PyTorch Lightning Trainer. + +.. note:: + Every NeMo model has an example configuration file and training script that can be found `here `__. + +The end result of using NeMo, `Pytorch Lightning `__, and Hydra is that NeMo models all have the same look and feel and are also fully compatible with the PyTorch ecosystem. + +Pretrained +---------- + +NeMo comes with many pretrained models for each of our collections: ASR, TTS, Audio, and SpeechLM2. Every pretrained NeMo model can be downloaded +and used with the ``from_pretrained()`` method. + +As an example, we can instantiate a Parakeet model with the following: + +.. code-block:: Python + + import nemo.collections.asr as nemo_asr + + model = nemo_asr.models.ASRModel.from_pretrained(model_name="nvidia/parakeet-tdt-0.6b-v2") + +To see all available pretrained models for a specific NeMo model, use the ``list_available_models()`` method: + +.. code-block:: Python + + nemo_asr.models.EncDecCTCModel.list_available_models() + +For detailed information on the available pretrained models, refer to the collections documentation: + +- :doc:`Automatic Speech Recognition (ASR) <../asr/intro>` +- :doc:`Text-to-Speech Synthesis (TTS) <../tts/intro>` + +Training +-------- + +NeMo leverages `PyTorch Lightning `__ for model training. PyTorch Lightning lets NeMo decouple the +conversational AI code from the PyTorch training code. This means that NeMo users can focus on their domain (ASR, NLP, TTS) and +build complex AI applications without having to rewrite boilerplate code for PyTorch training. + +When using PyTorch Lightning, NeMo users can automatically train with: + +- multi-GPU/multi-node +- mixed precision +- model checkpointing +- logging +- early stopping +- and more + +The two main aspects of the Lightning API are the `LightningModule `_ +and the `Trainer `_. + +PyTorch Lightning ``LightningModule`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Every NeMo model is a ``LightningModule`` which is an ``nn.module``. This means that NeMo models are compatible with the PyTorch +ecosystem and can be plugged into existing PyTorch workflows. + +Creating a NeMo model is similar to any other PyTorch workflow. We start by initializing our model architecture, then define the forward pass: + +.. code-block:: python + + class TextClassificationModel(NLPModel, Exportable): + ... + def __init__(self, cfg: DictConfig, trainer: Trainer = None): + """Initializes the BERTTextClassifier model.""" + ... + super().__init__(cfg=cfg, trainer=trainer) + + # instantiate a BERT based encoder + self.bert_model = get_lm_model( + config_file=cfg.language_model.config_file, + config_dict=cfg.language_model.config, + vocab_file=cfg.tokenizer.vocab_file, + trainer=trainer, + cfg=cfg, + ) + + # instantiate the FFN for classification + self.classifier = SequenceClassifier( + hidden_size=self.bert_model.config.hidden_size, + num_classes=cfg.dataset.num_classes, + num_layers=cfg.classifier_head.num_output_layers, + activation='relu', + log_softmax=False, + dropout=cfg.classifier_head.fc_dropout, + use_transformer_init=True, + idx_conditioned_on=0, + ) + +.. code-block:: python + + def forward(self, input_ids, token_type_ids, attention_mask): + """ + No special modification required for Lightning, define it as you normally would + in the `nn.Module` in vanilla PyTorch. + """ + hidden_states = self.bert_model( + input_ids=input_ids, token_type_ids=token_type_ids, attention_mask=attention_mask + ) + logits = self.classifier(hidden_states=hidden_states) + return logits + +The ``LightningModule`` organizes PyTorch code so that across all NeMo models we have a similar look and feel. +For example, the training logic can be found in ``training_step``: + +.. code-block:: python + + def training_step(self, batch, batch_idx): + """ + Lightning calls this inside the training loop with the data from the training dataloader + passed in as `batch`. + """ + # forward pass + input_ids, input_type_ids, input_mask, labels = batch + logits = self.forward(input_ids=input_ids, token_type_ids=input_type_ids, attention_mask=input_mask) + + train_loss = self.loss(logits=logits, labels=labels) + + lr = self._optimizer.param_groups[0]['lr'] + + self.log('train_loss', train_loss) + self.log('lr', lr, prog_bar=True) + + return { + 'loss': train_loss, + 'lr': lr, + } + +While validation logic can be found in ``validation_step``: + +.. code-block:: python + + def validation_step(self, batch, batch_idx): + """ + Lightning calls this inside the validation loop with the data from the validation dataloader + passed in as `batch`. + """ + if self.testing: + prefix = 'test' + else: + prefix = 'val' + + input_ids, input_type_ids, input_mask, labels = batch + logits = self.forward(input_ids=input_ids, token_type_ids=input_type_ids, attention_mask=input_mask) + + val_loss = self.loss(logits=logits, labels=labels) + + preds = torch.argmax(logits, axis=-1) + + tp, fn, fp, _ = self.classification_report(preds, labels) + + return {'val_loss': val_loss, 'tp': tp, 'fn': fn, 'fp': fp} + +PyTorch Lightning then handles all of the boilerplate code needed for training. Virtually any aspect of training can be customized +via PyTorch Lightning `hooks `_, +`Plugins `_, +`callbacks `_, or by overriding `methods `_. + +For more domain-specific information, see: + +- :doc:`Automatic Speech Recognition (ASR) <../asr/intro>` +- :doc:`Text-to-Speech Synthesis (TTS) <../tts/intro>` + +PyTorch Lightning Trainer +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Since every NeMo model is a ``LightningModule``, we can automatically take advantage of the PyTorch Lightning ``Trainer``. Every NeMo +`example `_ training script uses the ``Trainer`` object to fit the model. + +First, instantiate the model and trainer, then call ``.fit``: + +.. code-block:: python + + # We first instantiate the trainer based on the model configuration. + # See the model configuration documentation for details. + trainer = pl.Trainer(**cfg.trainer) + + # Then pass the model configuration and trainer object into the NeMo model + model = TextClassificationModel(cfg.model, trainer=trainer) + + # Now we can train with by calling .fit + trainer.fit(model) + + # Or we can run the test loop on test data by calling + trainer.test(model=model) + +All `trainer flags `_ can be set from from the NeMo configuration. + + +Configuration +------------- + +Hydra is an open-source Python framework that simplifies configuration for complex applications that must bring together many different +software libraries. Conversational AI model training is a great example of such an application. To train a conversational AI model, we +must be able to configure: + +- neural network architectures +- training and optimization algorithms +- data pre/post processing +- data augmentation +- experiment logging/visualization +- model checkpointing + +For an introduction to using Hydra, refer to the `Hydra Tutorials `_. + +With Hydra, we can configure everything needed for NeMo with three interfaces: + +- Command Line (CLI) +- Configuration Files (YAML) +- Dataclasses (Python) + +YAML +~~~~ + +NeMo provides YAML configuration files for all of our `example `_ training scripts. +YAML files make it easy to experiment with different model and training configurations. + +Every NeMo example YAML has the same underlying configuration structure: + +- trainer +- exp_manager +- model + +The model configuration always contains ``train_ds``, ``validation_ds``, ``test_ds``, and ``optim``. Model architectures, however, can vary across domains. +Refer to the documentation of specific collections (LLM, ASR etc.) for detailed information on model architecture configuration. + +A NeMo configuration file should look similar to the following: + +.. code-block:: yaml + + # PyTorch Lightning Trainer configuration + # any argument of the Trainer object can be set here + trainer: + devices: 1 # number of gpus per node + accelerator: gpu + num_nodes: 1 # number of nodes + max_epochs: 10 # how many training epochs to run + val_check_interval: 1.0 # run validation after every epoch + + # Experiment logging configuration + exp_manager: + exp_dir: /path/to/my/nemo/experiments + name: name_of_my_experiment + create_tensorboard_logger: True + create_wandb_logger: True + + # Model configuration + # model network architecture, train/val/test datasets, data augmentation, and optimization + model: + train_ds: + manifest_filepath: /path/to/my/train/manifest.json + batch_size: 256 + shuffle: True + validation_ds: + manifest_filepath: /path/to/my/validation/manifest.json + batch_size: 32 + shuffle: False + test_ds: + manifest_filepath: /path/to/my/test/manifest.json + batch_size: 32 + shuffle: False + optim: + name: novograd + lr: .01 + betas: [0.8, 0.5] + weight_decay: 0.001 + # network architecture can vary greatly depending on the domain + encoder: + ... + decoder: + ... + +CLI +~~~ + +With NeMo and Hydra, every aspect of model training can be modified from the command-line. This is extremely helpful for running lots +of experiments on compute clusters or for quickly testing parameters during development. + +All NeMo `examples `_ come with instructions on how to +run the training/inference script from the command-line (e.g. see `here `__ +for an example). + +With Hydra, arguments are set using the ``=`` operator: + +.. code-block:: bash + + python examples/asr/asr_ctc/speech_to_text_ctc.py \ + model.train_ds.manifest_filepath=/path/to/my/train/manifest.json \ + model.validation_ds.manifest_filepath=/path/to/my/validation/manifest.json \ + trainer.devices=2 \ + trainer.accelerator='gpu' \ + trainer.max_epochs=50 + +We can use the ``+`` operator to add arguments from the CLI: + +.. code-block:: bash + + python examples/asr/asr_ctc/speech_to_text_ctc.py \ + model.train_ds.manifest_filepath=/path/to/my/train/manifest.json \ + model.validation_ds.manifest_filepath=/path/to/my/validation/manifest.json \ + trainer.devices=2 \ + trainer.accelerator='gpu' \ + trainer.max_epochs=50 \ + +trainer.fast_dev_run=true + +We can use the ``~`` operator to remove configurations: + +.. code-block:: bash + + python examples/asr/asr_ctc/speech_to_text_ctc.py \ + model.train_ds.manifest_filepath=/path/to/my/train/manifest.json \ + model.validation_ds.manifest_filepath=/path/to/my/validation/manifest.json \ + ~model.test_ds \ + trainer.devices=2 \ + trainer.accelerator='gpu' \ + trainer.max_epochs=50 \ + +trainer.fast_dev_run=true + +We can specify configuration files using the ``--config-path`` and ``--config-name`` flags: + +.. code-block:: bash + + python examples/asr/asr_ctc/speech_to_text_ctc.py \ + --config-path=conf/conformer \ + --config-name=conformer_ctc_bpe \ + model.train_ds.manifest_filepath=/path/to/my/train/manifest.json \ + model.validation_ds.manifest_filepath=/path/to/my/validation/manifest.json \ + ~model.test_ds \ + trainer.devices=2 \ + trainer.accelerator='gpu' \ + trainer.max_epochs=50 \ + +trainer.fast_dev_run=true + +Dataclasses +~~~~~~~~~~~ + +Dataclasses allow NeMo to ship model configurations as part of the NeMo library and also enables pure Python configuration of NeMo models. +With Hydra, dataclasses can be used to create `structured configs `_ for the conversational AI application. + +As an example, refer to the code block below for an *Attenion is All You Need* machine translation model. The model configuration can +be instantiated and modified like any Python `Dataclass `_. + +.. code-block:: Python + + from nemo.collections.nlp.models.machine_translation.mt_enc_dec_config import AAYNBaseConfig + + cfg = AAYNBaseConfig() + + # modify the number of layers in the encoder + cfg.encoder.num_layers = 8 + + # modify the training batch size + cfg.train_ds.tokens_in_batch = 8192 + +.. note:: Configuration with Hydra always has the following precedence CLI > YAML > Dataclass. + +.. _optimization-label: + +Optimization +------------ + +Optimizers and learning rate schedules are configurable across all NeMo models and have their own namespace. Here is a sample YAML +configuration for a Novograd optimizer with a Cosine Annealing learning rate schedule. + +.. code-block:: yaml + + optim: + name: novograd + lr: 0.01 + + # optimizer arguments + betas: [0.8, 0.25] + weight_decay: 0.001 + + # scheduler setup + sched: + name: CosineAnnealing + + # Optional arguments + max_steps: -1 # computed at runtime or explicitly set here + monitor: val_loss + reduce_on_plateau: false + + # scheduler config override + warmup_steps: 1000 + warmup_ratio: null + min_lr: 1e-9: + +.. note:: `NeMo Examples `_ has optimizer and scheduler configurations for every NeMo model. + +Optimizers can be configured from the CLI as well: + +.. code-block:: bash + + python examples/asr/asr_ctc/speech_to_text_ctc.py \ + --config-path=conf/conformer \ + --config-name=conformer_ctc_bpe \ + ... + # train with the adam optimizer + model.optim=adam \ + # change the learning rate + model.optim.lr=.0004 \ + # modify betas + model.optim.betas=[.8, .5] + +.. _optimizers-label: + +Optimizers +~~~~~~~~~~ + +``name`` corresponds to the lowercase name of the optimizer. To view a list of available optimizers, run: + +.. code-block:: Python + + from nemo.core.optim.optimizers import AVAILABLE_OPTIMIZERS + + for name, opt in AVAILABLE_OPTIMIZERS.items(): + print(f'name: {name}, opt: {opt}') + +.. code-block:: bash + + name: sgd opt: + name: adam opt: + name: adamw opt: + name: adadelta opt: + name: adamax opt: + name: adagrad opt: + name: rmsprop opt: + name: rprop opt: + name: novograd opt: + +Optimizer Params +~~~~~~~~~~~~~~~~ + +Optimizer params can vary between optimizers but the ``lr`` param is required for all optimizers. To see the available params for an +optimizer, we can look at its corresponding dataclass. + +.. code-block:: python + + from nemo.core.config.optimizers import NovogradParams + + print(NovogradParams()) + +.. code-block:: bash + + NovogradParams(lr='???', betas=(0.95, 0.98), eps=1e-08, weight_decay=0, grad_averaging=False, amsgrad=False, luc=False, luc_trust=0.001, luc_eps=1e-08) + +``'???'`` indicates that the lr argument is required. + +Register Optimizer +~~~~~~~~~~~~~~~~~~ + +To register a new optimizer to be used with NeMo, run: + +.. autofunction:: nemo.core.optim.optimizers.register_optimizer + +.. _learning-rate-schedulers-label: + +Learning Rate Schedulers +~~~~~~~~~~~~~~~~~~~~~~~~ + +Learning rate schedulers can be optionally configured under the ``optim.sched`` namespace. + +``name`` corresponds to the name of the learning rate schedule. To view a list of available schedulers, run: + +.. code-block:: Python + + from nemo.core.optim.lr_scheduler import AVAILABLE_SCHEDULERS + + for name, opt in AVAILABLE_SCHEDULERS.items(): + print(f'name: {name}, schedule: {opt}') + +.. code-block:: bash + + name: WarmupPolicy, schedule: + name: WarmupHoldPolicy, schedule: + name: SquareAnnealing, schedule: + name: CosineAnnealing, schedule: + name: NoamAnnealing, schedule: + name: WarmupAnnealing, schedule: + name: InverseSquareRootAnnealing, schedule: + name: SquareRootAnnealing, schedule: + name: PolynomialDecayAnnealing, schedule: + name: PolynomialHoldDecayAnnealing, schedule: + name: StepLR, schedule: + name: ExponentialLR, schedule: + name: ReduceLROnPlateau, schedule: + name: CyclicLR, schedule: + +Scheduler Params +~~~~~~~~~~~~~~~~ + +To see the available params for a scheduler, we can look at its corresponding dataclass: + +.. code-block:: Python + + from nemo.core.config.schedulers import CosineAnnealingParams + + print(CosineAnnealingParams()) + +.. code-block:: bash + + CosineAnnealingParams(last_epoch=-1, warmup_steps=None, warmup_ratio=None, min_lr=0.0) + +Register scheduler +~~~~~~~~~~~~~~~~~~ + +To register a new scheduler to be used with NeMo, run: + +.. autofunction:: nemo.core.optim.lr_scheduler.register_scheduler + +Save and Restore +---------------- + +NeMo models all come with ``.save_to`` and ``.restore_from`` methods. + +Save +~~~~ + +To save a NeMo model, run: + +.. code-block:: Python + + model.save_to('/path/to/model.nemo') + +Everything needed to use the trained model is packaged and saved in the ``.nemo`` file. For example, in the NLP domain, ``.nemo`` files +include the necessary tokenizer models and/or vocabulary files, etc. + +.. note:: A ``.nemo`` file is simply an archive like any other ``.tar`` file. + +Restore +~~~~~~~ + +To restore a NeMo model, run: + +.. code-block:: Python + + # Here, you should usually use the class of the model, or simply use ModelPT.restore_from() for simplicity. + model.restore_from('/path/to/model.nemo') + +When using the PyTorch Lightning Trainer, a PyTorch Lightning checkpoint is created. These are mainly used within NeMo to auto-resume +training. Since NeMo models are ``LightningModules``, the PyTorch Lightning method ``load_from_checkpoint`` is available. Note that +``load_from_checkpoint`` won't necessarily work out-of-the-box for all models as some models require more artifacts than just the +checkpoint to be restored. For these models, the user will have to override ``load_from_checkpoint`` if they want to use it. + +It's highly recommended to use ``restore_from`` to load NeMo models. + +Restore with Modified Config +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Sometimes, there may be a need to modify the model (or it's sub-components) prior to restoring a model. A common case is when +the model's internal config must be updated due to various reasons (such as deprecation, newer versioning, support a new feature). +As long as the model has the same parameters as compared to the original config, the parameters can once again be restored safely. + +In NeMo, as part of the .nemo file, the model's internal config will be preserved. This config is used during restoration, and +as shown below we can update this config prior to restoring the model. + +.. code-block:: + + # When restoring a model, you should generally use the class of the model + # Obtain the config (as an OmegaConf object) + config = model_class.restore_from('/path/to/model.nemo', return_config=True) + # OR + config = model_class.from_pretrained('name_of_the_model', return_config=True) + + # Modify the config as needed + config.x.y = z + + # Restore the model from the updated config + model = model_class.restore_from('/path/to/model.nemo', override_config_path=config) + # OR + model = model_class.from_pretrained('name_of_the_model', override_config_path=config) + +Register Artifacts +------------------ + +Restoring conversational AI models can be complicated because it requires more than just the checkpoint weights; additional information is also needed to use the model. +NeMo models can save additional artifacts in the .nemo file by calling ``.register_artifact``. +When restoring NeMo models using ``.restore_from`` or ``.from_pretrained``, any artifacts that were registered will be available automatically. + +As an example, consider an NLP model that requires a trained tokenizer model. +The tokenizer model file can be automatically added to the .nemo file with the following: + +.. code-block:: python + + self.encoder_tokenizer = get_nmt_tokenizer( + ... + tokenizer_model=self.register_artifact(config_path='encoder_tokenizer.tokenizer_model', + src='/path/to/tokenizer.model', + verify_src_exists=True), + ) + +By default, ``.register_artifact`` will always return a path. If the model is being restored from a .nemo file, +then that path will be to the artifact in the .nemo file. Otherwise, ``.register_artifact`` will return the local path specified by the user. + +``config_path`` is the artifact key. It usually corresponds to a model configuration but does not have to. +The model config that is packaged with the .nemo file will be updated according to the ``config_path`` key. +In the above example, the model config will have + +.. code-block:: YAML + + encoder_tokenizer: + ... + tokenizer_model: nemo:4978b28103264263a03439aaa6560e5e_tokenizer.model + +``src`` is the path to the artifact and the base-name of the path will be used when packaging the artifact in the .nemo file. +Each artifact will have a hash prepended to the basename of ``src`` in the .nemo file. This is to prevent collisions with basenames +base-names that are identical (say when there are two or more tokenizers, both called `tokenizer.model`). +The resulting .nemo file will then have the following file: + +.. code-block:: bash + + 4978b28103264263a03439aaa6560e5e_tokenizer.model + +If ``verify_src_exists`` is set to ``False``, then the artifact is optional. This means that ``.register_artifact`` will return ``None`` +if the ``src`` cannot be found. + +Push to Hugging Face Hub +------------------------ + +NeMo models can be pushed to the `Hugging Face Hub `_ with the :meth:`~nemo.core.classes.mixins.hf_io_mixin.HuggingFaceFileIO.push_to_hf_hub` method. This method performs the same actions as ``save_to()`` and then uploads the model to the HuggingFace Hub. It offers an additional ``pack_nemo_file`` argument that allows the user to upload the entire NeMo file or just the ``.nemo`` file. This is useful for large language models that have a massive number of parameters, and a single NeMo file could exceed the max upload size of Hugging Face Hub. + + +Upload a model to the Hub +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + token = "" or None + pack_nemo_file = True # False will upload multiple files that comprise the NeMo file onto HF Hub; Generally useful for LLMs + + model.push_to_hf_hub( + repo_id=repo_id, pack_nemo_file=pack_nemo_file, token=token, + ) + +Use a Custom Model Card Template for the Hub +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + # Override the default model card + template = """ + # {model_name} + """ + kwargs = {"model_name": "ABC", "repo_id": "nvidia/ABC_XYZ"} + model_card = model.generate_model_card(template=template, template_kwargs=kwargs, type="hf") + + model.push_to_hf_hub( + repo_id=repo_id, token=token, model_card=model_card + ) + + # Write your own model card class + class MyModelCard: + def __init__(self, model_name): + self.model_name = model_name + + def __repr__(self): + template = """This is the {model_name} model""".format(model_name=self.model_name) + return template + + model.push_to_hf_hub( + repo_id=repo_id, token=token, model_card=MyModelCard("ABC") + ) + + +Nested NeMo Models +------------------ + +In some cases, it may be helpful to use NeMo models inside other NeMo models. For example, we can incorporate language models into ASR models to use in a decoding process to improve accuracy. + +There are three ways to instantiate child models inside parent models: + +- use subconfig directly +- use the ``.nemo`` checkpoint path to load the child model +- use a pretrained NeMo model + +To register a child model, use the ``register_nemo_submodule`` method of the parent model. This method will add the child model to a specified model attribute. During serialization, it will correctly handle child artifacts and store the child model’s configuration in the parent model’s ``config_field``. + +.. code-block:: python + + from nemo.core.classes import ModelPT + + class ChildModel(ModelPT): + ... # implement necessary methods + + class ParentModel(ModelPT): + def __init__(self, cfg, trainer=None): + super().__init__(cfg=cfg, trainer=trainer) + + # optionally annotate type for IDE autocompletion and type checking + self.child_model: Optional[ChildModel] + if cfg.get("child_model") is not None: + # load directly from config + # either if config provided initially, or automatically + # after model restoration + self.register_nemo_submodule( + name="child_model", + config_field="child_model", + model=ChildModel(self.cfg.child_model, trainer=trainer), + ) + elif cfg.get('child_model_path') is not None: + # load from .nemo model checkpoint + # while saving, config will be automatically assigned/updated + # in cfg.child_model + self.register_nemo_submodule( + name="child_model", + config_field="child_model", + model=ChildModel.restore_from(self.cfg.child_model_path, trainer=trainer), + ) + elif cfg.get('child_model_name') is not None: + # load from pretrained model + # while saving, config will be automatically assigned/updated + # in cfg.child_model + self.register_nemo_submodule( + name="child_model", + config_field="child_model", + model=ChildModel.from_pretrained(self.cfg.child_model_name, trainer=trainer), + ) + else: + self.child_model = None + + + +Profiling +--------- + +NeMo offers users two options for profiling: Nsys and CUDA memory profiling. These two options allow users +to debug performance issues as well as memory issues such as memory leaks. + +To enable Nsys profiling, add the following options to the model config: + +.. code-block:: yaml + + nsys_profile: False + start_step: 10 # Global batch to start profiling + end_step: 10 # Global batch to end profiling + ranks: [0] # Global rank IDs to profile + gen_shape: False # Generate model and kernel details including input shapes + +Finally, run the model training script with: + +.. code-block:: bash + + nsys profile -s none -o -t cuda,nvtx --force-overwrite true --capture-range=cudaProfilerApi --capture-range-end=stop python ./examples/... + +See more options at `nsight user guide `_. + + + +To enable CUDA memory profiling, add the following options to the model config: + +.. code-block:: yaml + + memory_profile: + enabled: True + start_step: 10 # Global batch to start profiling + end_step: 10 # Global batch to end profiling + rank: 0 # Global rank ID to profile + output_path: None # Path to store the profile output file + +Then invoke your NeMo script without any changes in the invocation command.