refactor file locations

This commit is contained in:
Ramnique Singh 2025-08-18 07:08:26 +05:30
parent 5675cda52b
commit 53219974d3
24 changed files with 39 additions and 72 deletions

View file

@ -3,7 +3,7 @@ import {
CopilotAPIRequest,
CopilotChatContext, CopilotMessage,
DataSourceSchemaForCopilot,
} from "../lib/types/copilot_types";
} from "../../src/application/lib/copilot/types";
import {
Workflow} from "../lib/types/workflow_types";
import { z } from 'zod';
@ -11,7 +11,7 @@ import { projectAuthCheck } from "./project.actions";
import { redisClient } from "../lib/redis";
import { authorizeUserAction, logUsage } from "./billing.actions";
import { USE_BILLING } from "../lib/feature_flags";
import { getEditAgentInstructionsResponse } from "../lib/copilot/copilot";
import { getEditAgentInstructionsResponse } from "../../src/application/lib/copilot/copilot";
import { container } from "@/di/container";
import { IUsageQuotaPolicy } from "@/src/application/policies/usage-quota.policy.interface";
import { UsageTracker } from "../lib/billing";

View file

@ -1,8 +1,8 @@
import { getCustomerIdForProject, logUsage, UsageTracker } from "@/app/lib/billing";
import { USE_BILLING } from "@/app/lib/feature_flags";
import { redisClient } from "@/app/lib/redis";
import { CopilotAPIRequest } from "@/app/lib/types/copilot_types";
import { streamMultiAgentResponse } from "@/app/lib/copilot/copilot";
import { CopilotAPIRequest } from "@/src/application/lib/copilot/types";
import { streamMultiAgentResponse } from "@/src/application/lib/copilot/copilot";
export async function GET(request: Request, props: { params: Promise<{ streamId: string }> }) {
const params = await props.params;

View file

@ -1,4 +1,4 @@
import { getResponse } from "@/app/lib/agents";
import { getResponse } from "@/src/application/lib/agents-runtime/agents";
import { twilioConfigsCollection, twilioInboundCallsCollection } from "@/app/lib/mongodb";
import { PrefixLogger } from "@/app/lib/utils";
import VoiceResponse from "twilio/lib/twiml/VoiceResponse";

View file

@ -1,4 +1,4 @@
import { getResponse } from "@/app/lib/agents";
import { getResponse } from "@/src/application/lib/agents-runtime/agents";
import { twilioInboundCallsCollection } from "@/app/lib/mongodb";
import { PrefixLogger } from "@/app/lib/utils";
import VoiceResponse from "twilio/lib/twiml/VoiceResponse";

View file

@ -7,7 +7,7 @@ import { authCheck } from "../../../utils";
import { PrefixLogger } from "../../../../../../lib/utils";
import { authorize, getCustomerIdForProject, logUsage } from "@/app/lib/billing";
import { USE_BILLING } from "@/app/lib/feature_flags";
import { getResponse } from "@/app/lib/agents";
import { getResponse } from "@/src/application/lib/agents-runtime/agents";
import { Message, AssistantMessage, AssistantMessageWithToolCalls, ToolMessage } from "@/app/lib/types/types";
import { IUsageQuotaPolicy } from "@/src/application/policies/usage-quota.policy.interface";
import { container } from "@/di/container";

View file

@ -1,31 +0,0 @@
// Server name to URL parameter mapping
export const SERVER_URL_PARAMS: Record<string, string> = {
'Google Calendar': 'gcalendar',
'Google Drive': 'gdrive',
'Google Docs': 'gdocs',
'Google Sheets': 'gsheets',
'Gmail': 'gmail',
'GitHub': 'github',
'Slack': 'slack',
'Jira': 'jira',
'Notion': 'notion',
'Supabase': 'supabase',
'WordPress': 'wordpress',
'Asana': 'asana',
'Close': 'close',
'Confluence': 'confluence',
'Salesforce': 'salesforce',
'Linear': 'linear',
'Attio': 'attio'
};
// Server name to environment variable mapping for client IDs
export const SERVER_CLIENT_ID_MAP: Record<string, string | undefined> = {
'GitHub': process.env.KLAVIS_GITHUB_CLIENT_ID,
'Google Calendar': process.env.KLAVIS_GOOGLE_CLIENT_ID,
'Google Drive': process.env.KLAVIS_GOOGLE_CLIENT_ID,
'Google Docs': process.env.KLAVIS_GOOGLE_CLIENT_ID,
'Google Sheets': process.env.KLAVIS_GOOGLE_CLIENT_ID,
'Gmail': process.env.KLAVIS_GOOGLE_CLIENT_ID,
'Slack': process.env.KLAVIS_SLACK_ID,
};

View file

@ -2,8 +2,8 @@
import { Button } from "@/components/ui/button";
import { Dropdown, DropdownItem, DropdownMenu, DropdownSection, DropdownTrigger, Spinner, Tooltip } from "@heroui/react";
import { useRef, useState, createContext, useContext, useCallback, forwardRef, useImperativeHandle, useEffect, Ref } from "react";
import { CopilotChatContext } from "../../../lib/types/copilot_types";
import { CopilotMessage } from "../../../lib/types/copilot_types";
import { CopilotChatContext } from "../../../../src/application/lib/copilot/types";
import { CopilotMessage } from "../../../../src/application/lib/copilot/types";
import { Workflow } from "@/app/lib/types/workflow_types";
import { DataSource } from "@/src/entities/models/data-source";
import { z } from "zod";

View file

@ -2,7 +2,7 @@
import { createContext, useContext, useRef, useState } from "react";
import clsx from "clsx";
import { z } from "zod";
import { CopilotAssistantMessageActionPart } from "../../../../lib/types/copilot_types";
import { CopilotAssistantMessageActionPart } from "../../../../../src/application/lib/copilot/types";
import { Workflow } from "../../../../lib/types/workflow_types";
import { PreviewModalProvider, usePreviewModal } from '../../workflow/preview-modal';
import { getAppliedChangeKey } from "../app";

View file

@ -5,7 +5,7 @@ import { z } from "zod";
import { Workflow} from "@/app/lib/types/workflow_types";
import MarkdownContent from "@/app/lib/components/markdown-content";
import { MessageSquareIcon, EllipsisIcon, XIcon, CheckCheckIcon, ChevronDown, ChevronUp } from "lucide-react";
import { CopilotMessage, CopilotAssistantMessage, CopilotAssistantMessageActionPart } from "@/app/lib/types/copilot_types";
import { CopilotMessage, CopilotAssistantMessage, CopilotAssistantMessageActionPart } from "@/src/application/lib/copilot/types";
import { Action, StreamingAction } from './actions';
import { useParsedBlocks } from "../use-parsed-blocks";
import { validateConfigChanges } from "@/app/lib/client_utils";

View file

@ -1,6 +1,6 @@
import { useCallback, useRef, useState } from "react";
import { getCopilotResponseStream } from "@/app/actions/copilot.actions";
import { CopilotMessage } from "@/app/lib/types/copilot_types";
import { CopilotMessage } from "@/src/application/lib/copilot/types";
import { Workflow } from "@/app/lib/types/workflow_types";
import { DataSource } from "@/src/entities/models/data-source";
import { z } from "zod";

View file

@ -7,7 +7,7 @@ import { useState, useEffect, useRef } from "react";
import { usePreviewModal } from "../workflow/preview-modal";
import { Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Select, SelectItem, Chip, SelectSection } from "@heroui/react";
import { PreviewModalProvider } from "../workflow/preview-modal";
import { CopilotMessage } from "@/app/lib/types/copilot_types";
import { CopilotMessage } from "@/src/application/lib/copilot/types";
import { getCopilotAgentInstructions } from "@/app/actions/copilot.actions";
import { Dropdown as CustomDropdown } from "../../../lib/components/dropdown";
import { createAtMentions } from "../../../lib/components/atmentions";

View file

@ -1,10 +1,8 @@
// Agent handoffs using OpenAI Agents SDK native capabilities
import { Agent, handoff, Handoff } from "@openai/agents";
import { z } from "zod";
import { PrefixLogger } from "./utils";
import {
WorkflowAgent
} from "./types/workflow_types";
import { PrefixLogger } from "@/app/lib/utils";
import { WorkflowAgent } from "@/app/lib/types/workflow_types";
import {
HandoffContext,
PipelineContext,

View file

@ -3,18 +3,18 @@ import { tool, Tool } from "@openai/agents";
import { createOpenAI } from "@ai-sdk/openai";
import { embed, generateText } from "ai";
import { z } from "zod";
import { composio } from "../../src/application/lib/composio/composio";
import { composio } from "@/src/application/lib/composio/composio";
import { SignJWT } from "jose";
import crypto from "crypto";
// Internal dependencies
import { embeddingModel } from '../lib/embedding';
import { getMcpClient } from "./mcp";
import { qdrantClient } from '../lib/qdrant';
import { EmbeddingRecord } from "./types/datasource_types";
import { WorkflowAgent, WorkflowTool } from "./types/workflow_types";
import { PrefixLogger } from "./utils";
import { UsageTracker } from "./billing";
import { embeddingModel } from "@/app/lib/embedding";
import { getMcpClient } from "@/app/lib/mcp";
import { qdrantClient } from "@/app/lib/qdrant";
import { EmbeddingRecord } from "@/app/lib/types/datasource_types";
import { WorkflowAgent, WorkflowTool } from "@/app/lib/types/workflow_types";
import { PrefixLogger } from "@/app/lib/utils";
import { UsageTracker } from "@/app/lib/billing";
import { DataSource } from "@/src/entities/models/data-source";
import { IDataSourcesRepository } from "@/src/application/repositories/data-sources.repository.interface";
import { IDataSourceDocsRepository } from "@/src/application/repositories/data-source-docs.repository.interface";

View file

@ -8,11 +8,11 @@ import crypto from "crypto";
// Internal dependencies
import { createTools, createRagTool } from "./agent-tools";
import { ConnectedEntity, sanitizeTextWithMentions, Workflow, WorkflowAgent, WorkflowPipeline, WorkflowPrompt, WorkflowTool } from "./types/workflow_types";
import { ConnectedEntity, sanitizeTextWithMentions, Workflow, WorkflowAgent, WorkflowPipeline, WorkflowPrompt, WorkflowTool } from "@/app/lib/types/workflow_types";
import { CHILD_TRANSFER_RELATED_INSTRUCTIONS, CONVERSATION_TYPE_INSTRUCTIONS, PIPELINE_TYPE_INSTRUCTIONS, RAG_INSTRUCTIONS, TASK_TYPE_INSTRUCTIONS } from "./agent_instructions";
import { PrefixLogger } from "./utils";
import { Message, AssistantMessage, AssistantMessageWithToolCalls, ToolMessage } from "./types/types";
import { UsageTracker } from "./billing";
import { PrefixLogger } from "@/app/lib/utils";
import { Message, AssistantMessage, AssistantMessageWithToolCalls, ToolMessage } from "@/app/lib/types/types";
import { UsageTracker } from "@/app/lib/billing";
// Native handoff support
import { createAgentHandoff, getSchemaForAgent, createContextFilterForAgent } from "./agent-handoffs";

View file

@ -1,9 +1,9 @@
// Pipeline State Manager for handling complex pipeline execution flow
import { Agent } from "@openai/agents";
import { z } from "zod";
import { WorkflowPipeline, WorkflowAgent } from "./types/workflow_types";
import { WorkflowPipeline, WorkflowAgent } from "@/app/lib/types/workflow_types";
import { PipelineExecutionState } from "./agents";
import { PrefixLogger } from "./utils";
import { PrefixLogger } from "@/app/lib/utils";
import { createPipelineHandoff } from "./agent-handoffs";
export interface PipelineExecutionResult {

View file

@ -1,5 +1,5 @@
import { z } from "zod";
import { PrefixLogger } from "../../../../app/lib/utils";
import { PrefixLogger } from "@/app/lib/utils";
import { Composio } from "@composio/core";
import { ZAuthConfig, ZConnectedAccount, ZCreateAuthConfigRequest, ZCreateAuthConfigResponse, ZCreateConnectedAccountRequest, ZCreateConnectedAccountResponse, ZDeleteOperationResponse, ZErrorResponse, ZGetToolkitResponse, ZListResponse, ZTool, ZToolkit, ZTriggerType } from "./types";

View file

@ -1,17 +1,17 @@
import z from "zod";
import { createOpenAI } from "@ai-sdk/openai";
import { generateObject, streamText, tool } from "ai";
import { Workflow, WorkflowTool } from "../types/workflow_types";
import { CopilotChatContext, CopilotMessage, DataSourceSchemaForCopilot } from "../types/copilot_types";
import { PrefixLogger } from "../utils";
import { Workflow, WorkflowTool } from "@/app/lib/types/workflow_types";
import { CopilotChatContext, CopilotMessage, DataSourceSchemaForCopilot } from "./types";
import { PrefixLogger } from "@/app/lib/utils";
import zodToJsonSchema from "zod-to-json-schema";
import { COPILOT_INSTRUCTIONS_EDIT_AGENT } from "./copilot_edit_agent";
import { COPILOT_INSTRUCTIONS_MULTI_AGENT } from "./copilot_multi_agent";
import { COPILOT_MULTI_AGENT_EXAMPLE_1 } from "./example_multi_agent_1";
import { CURRENT_WORKFLOW_PROMPT } from "./current_workflow";
import { USE_COMPOSIO_TOOLS } from "../feature_flags";
import { composio, getTool } from "../../../src/application/lib/composio/composio";
import { UsageTracker } from "../billing";
import { USE_COMPOSIO_TOOLS } from "@/app/lib/feature_flags";
import { composio, getTool } from "../composio/composio";
import { UsageTracker } from "@/app/lib/billing";
const PROVIDER_API_KEY = process.env.PROVIDER_API_KEY || process.env.OPENAI_API_KEY || '';
const PROVIDER_BASE_URL = process.env.PROVIDER_BASE_URL || undefined;

View file

@ -1,6 +1,6 @@
import { z } from "zod";
import { Workflow } from "./workflow_types";
import { Message } from "./types";
import { Workflow } from "@/app/lib/types/workflow_types";
import { Message } from "@/app/lib/types/types";
import { DataSource } from "@/src/entities/models/data-source";
export const DataSourceSchemaForCopilot = DataSource.pick({

View file

@ -3,7 +3,7 @@ import { USE_BILLING } from "@/app/lib/feature_flags";
import { authorize, getCustomerIdForProject, logUsage, UsageTracker } from "@/app/lib/billing";
import { NotFoundError } from '@/src/entities/errors/common';
import { IConversationsRepository } from "@/src/application/repositories/conversations.repository.interface";
import { streamResponse } from "@/app/lib/agents";
import { streamResponse } from "@/src/application/lib/agents-runtime/agents";
import { z } from "zod";
import { Message } from "@/app/lib/types/types";
import { IUsageQuotaPolicy } from '../../policies/usage-quota.policy.interface';