@elizaos/plugin-linear 1.2.11 → 1.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -10
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1154 -205
- package/dist/index.js.map +1 -1
- package/package.json +24 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/services/linear.ts","../src/types/index.ts","../src/actions/createIssue.ts","../src/actions/getIssue.ts","../src/actions/updateIssue.ts","../src/actions/searchIssues.ts","../src/actions/createComment.ts","../src/actions/listTeams.ts","../src/actions/listProjects.ts","../src/actions/getActivity.ts","../src/actions/clearActivity.ts","../src/index.ts"],"sourcesContent":["import { logger, Service, type IAgentRuntime } from '@elizaos/core';\nimport { LinearClient, Issue, Project, Team, User, WorkflowState, IssueLabel, Comment } from '@linear/sdk';\nimport type { \n LinearConfig, \n LinearActivityItem, \n LinearIssueInput, \n LinearCommentInput,\n LinearSearchFilters \n} from '../types';\nimport { LinearAPIError, LinearAuthenticationError } from '../types';\n\nexport class LinearService extends Service {\n static serviceType = 'linear';\n \n capabilityDescription = 'Linear API integration for issue tracking, project management, and team collaboration';\n \n private client: LinearClient;\n private activityLog: LinearActivityItem[] = [];\n private linearConfig: LinearConfig;\n private workspaceId?: string;\n \n constructor(runtime?: IAgentRuntime) {\n super(runtime);\n \n // Get config from runtime settings\n const apiKey = runtime?.getSetting('LINEAR_API_KEY') as string;\n const workspaceId = runtime?.getSetting('LINEAR_WORKSPACE_ID') as string;\n \n if (!apiKey) {\n throw new LinearAuthenticationError('Linear API key is required');\n }\n \n this.linearConfig = {\n LINEAR_API_KEY: apiKey,\n LINEAR_WORKSPACE_ID: workspaceId,\n };\n \n this.workspaceId = workspaceId;\n \n this.config = {\n LINEAR_API_KEY: apiKey,\n LINEAR_WORKSPACE_ID: workspaceId,\n };\n \n this.client = new LinearClient({\n apiKey: this.linearConfig.LINEAR_API_KEY,\n });\n }\n \n static async start(runtime: IAgentRuntime): Promise<LinearService> {\n const service = new LinearService(runtime);\n await service.validateConnection();\n logger.info('Linear service started successfully');\n return service;\n }\n \n async stop(): Promise<void> {\n this.activityLog = [];\n logger.info('Linear service stopped');\n }\n \n // Validate the API connection\n private async validateConnection(): Promise<void> {\n try {\n const viewer = await this.client.viewer;\n logger.info(`Linear connected as user: ${viewer.email}`);\n } catch (error) {\n throw new LinearAuthenticationError('Failed to authenticate with Linear API');\n }\n }\n \n // Log activity\n private logActivity(\n action: string,\n resourceType: LinearActivityItem['resource_type'],\n resourceId: string,\n details: Record<string, any>,\n success: boolean,\n error?: string\n ): void {\n const activity: LinearActivityItem = {\n id: `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,\n timestamp: new Date().toISOString(),\n action,\n resource_type: resourceType,\n resource_id: resourceId,\n details,\n success,\n error,\n };\n \n this.activityLog.push(activity);\n \n // Keep only last 1000 activities\n if (this.activityLog.length > 1000) {\n this.activityLog = this.activityLog.slice(-1000);\n }\n }\n \n // Get activity log\n getActivityLog(limit?: number, filter?: Partial<LinearActivityItem>): LinearActivityItem[] {\n let filtered = [...this.activityLog];\n \n if (filter) {\n filtered = filtered.filter(item => {\n return Object.entries(filter).every(([key, value]) => {\n return item[key as keyof LinearActivityItem] === value;\n });\n });\n }\n \n return filtered.slice(-(limit || 100));\n }\n \n // Clear activity log\n clearActivityLog(): void {\n this.activityLog = [];\n logger.info('Linear activity log cleared');\n }\n \n // Team operations\n async getTeams(): Promise<Team[]> {\n try {\n const teams = await this.client.teams();\n const teamList = await teams.nodes;\n \n this.logActivity('list_teams', 'team', 'all', { count: teamList.length }, true);\n return teamList;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('list_teams', 'team', 'all', {}, false, errorMessage);\n throw new LinearAPIError(`Failed to fetch teams: ${errorMessage}`);\n }\n }\n \n async getTeam(teamId: string): Promise<Team> {\n try {\n const team = await this.client.team(teamId);\n this.logActivity('get_team', 'team', teamId, { name: team.name }, true);\n return team;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('get_team', 'team', teamId, {}, false, errorMessage);\n throw new LinearAPIError(`Failed to fetch team: ${errorMessage}`);\n }\n }\n \n // Issue operations\n async createIssue(input: LinearIssueInput): Promise<Issue> {\n try {\n const issuePayload = await this.client.createIssue({\n title: input.title,\n description: input.description,\n teamId: input.teamId,\n priority: input.priority,\n assigneeId: input.assigneeId,\n labelIds: input.labelIds,\n projectId: input.projectId,\n stateId: input.stateId,\n estimate: input.estimate,\n dueDate: input.dueDate,\n });\n \n const issue = await issuePayload.issue;\n if (!issue) {\n throw new Error('Failed to create issue');\n }\n \n this.logActivity('create_issue', 'issue', issue.id, { \n title: input.title,\n teamId: input.teamId \n }, true);\n \n return issue;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('create_issue', 'issue', 'new', input, false, errorMessage);\n throw new LinearAPIError(`Failed to create issue: ${errorMessage}`);\n }\n }\n \n async getIssue(issueId: string): Promise<Issue> {\n try {\n const issue = await this.client.issue(issueId);\n this.logActivity('get_issue', 'issue', issueId, { \n title: issue.title,\n identifier: issue.identifier \n }, true);\n return issue;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('get_issue', 'issue', issueId, {}, false, errorMessage);\n throw new LinearAPIError(`Failed to fetch issue: ${errorMessage}`);\n }\n }\n \n async updateIssue(issueId: string, updates: Partial<LinearIssueInput>): Promise<Issue> {\n try {\n const updatePayload = await this.client.updateIssue(issueId, {\n title: updates.title,\n description: updates.description,\n priority: updates.priority,\n assigneeId: updates.assigneeId,\n labelIds: updates.labelIds,\n projectId: updates.projectId,\n stateId: updates.stateId,\n estimate: updates.estimate,\n dueDate: updates.dueDate,\n });\n \n const issue = await updatePayload.issue;\n if (!issue) {\n throw new Error('Failed to update issue');\n }\n \n this.logActivity('update_issue', 'issue', issueId, updates, true);\n return issue;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('update_issue', 'issue', issueId, updates, false, errorMessage);\n throw new LinearAPIError(`Failed to update issue: ${errorMessage}`);\n }\n }\n \n async searchIssues(filters: LinearSearchFilters): Promise<Issue[]> {\n try {\n const query = this.client.issues({\n first: filters.limit || 50,\n filter: filters.query ? {\n or: [\n { title: { containsIgnoreCase: filters.query } },\n { description: { containsIgnoreCase: filters.query } },\n ],\n } : undefined,\n });\n \n const issues = await query;\n const issueList = await issues.nodes;\n \n this.logActivity('search_issues', 'issue', 'search', { \n filters,\n count: issueList.length \n }, true);\n \n return issueList;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('search_issues', 'issue', 'search', filters, false, errorMessage);\n throw new LinearAPIError(`Failed to search issues: ${errorMessage}`);\n }\n }\n \n // Comment operations\n async createComment(input: LinearCommentInput): Promise<Comment> {\n try {\n const commentPayload = await this.client.createComment({\n body: input.body,\n issueId: input.issueId,\n });\n \n const comment = await commentPayload.comment;\n if (!comment) {\n throw new Error('Failed to create comment');\n }\n \n this.logActivity('create_comment', 'comment', comment.id, { \n issueId: input.issueId,\n bodyLength: input.body.length \n }, true);\n \n return comment;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('create_comment', 'comment', 'new', input, false, errorMessage);\n throw new LinearAPIError(`Failed to create comment: ${errorMessage}`);\n }\n }\n \n // Project operations\n async getProjects(teamId?: string): Promise<Project[]> {\n try {\n // Note: Linear SDK v51 may not support direct team filtering on projects\n // Get all projects and filter manually if needed\n const query = this.client.projects({\n first: 100,\n });\n \n const projects = await query;\n let projectList = await projects.nodes;\n \n // Manual filtering by team if teamId is provided\n if (teamId) {\n const filteredProjects = await Promise.all(\n projectList.map(async (project) => {\n const projectTeams = await project.teams();\n const teamsList = await projectTeams.nodes;\n const hasTeam = teamsList.some((team: any) => team.id === teamId);\n return hasTeam ? project : null;\n })\n );\n projectList = filteredProjects.filter(Boolean) as Project[];\n }\n \n this.logActivity('list_projects', 'project', 'all', { \n count: projectList.length,\n teamId \n }, true);\n \n return projectList;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('list_projects', 'project', 'all', { teamId }, false, errorMessage);\n throw new LinearAPIError(`Failed to fetch projects: ${errorMessage}`);\n }\n }\n \n async getProject(projectId: string): Promise<Project> {\n try {\n const project = await this.client.project(projectId);\n this.logActivity('get_project', 'project', projectId, { \n name: project.name \n }, true);\n return project;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('get_project', 'project', projectId, {}, false, errorMessage);\n throw new LinearAPIError(`Failed to fetch project: ${errorMessage}`);\n }\n }\n \n // User operations\n async getUsers(): Promise<User[]> {\n try {\n const users = await this.client.users();\n const userList = await users.nodes;\n \n this.logActivity('list_users', 'user', 'all', { \n count: userList.length \n }, true);\n \n return userList;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('list_users', 'user', 'all', {}, false, errorMessage);\n throw new LinearAPIError(`Failed to fetch users: ${errorMessage}`);\n }\n }\n \n async getCurrentUser(): Promise<User> {\n try {\n const user = await this.client.viewer;\n this.logActivity('get_current_user', 'user', user.id, { \n email: user.email,\n name: user.name \n }, true);\n return user;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('get_current_user', 'user', 'current', {}, false, errorMessage);\n throw new LinearAPIError(`Failed to fetch current user: ${errorMessage}`);\n }\n }\n \n // Label operations\n async getLabels(teamId?: string): Promise<IssueLabel[]> {\n try {\n const query = this.client.issueLabels({\n first: 100,\n filter: teamId ? {\n team: { id: { eq: teamId } },\n } : undefined,\n });\n \n const labels = await query;\n const labelList = await labels.nodes;\n \n this.logActivity('list_labels', 'label', 'all', { \n count: labelList.length,\n teamId \n }, true);\n \n return labelList;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('list_labels', 'label', 'all', { teamId }, false, errorMessage);\n throw new LinearAPIError(`Failed to fetch labels: ${errorMessage}`);\n }\n }\n \n // Workflow state operations\n async getWorkflowStates(teamId: string): Promise<WorkflowState[]> {\n try {\n const states = await this.client.workflowStates({\n filter: {\n team: { id: { eq: teamId } },\n },\n });\n \n const stateList = await states.nodes;\n \n this.logActivity('list_workflow_states', 'team', teamId, { \n count: stateList.length \n }, true);\n \n return stateList;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('list_workflow_states', 'team', teamId, {}, false, errorMessage);\n throw new LinearAPIError(`Failed to fetch workflow states: ${errorMessage}`);\n }\n }\n} ","export interface LinearConfig {\n LINEAR_API_KEY: string;\n LINEAR_WORKSPACE_ID?: string;\n}\n\nexport interface LinearActivityItem {\n id: string;\n timestamp: string;\n action: string;\n resource_type: 'issue' | 'project' | 'comment' | 'label' | 'user' | 'team';\n resource_id: string;\n details: Record<string, any>;\n success: boolean;\n error?: string;\n}\n\nexport interface LinearIssueInput {\n title: string;\n description?: string;\n teamId: string;\n priority?: number; // 0 = No priority, 1 = Urgent, 2 = High, 3 = Normal, 4 = Low\n assigneeId?: string;\n labelIds?: string[];\n projectId?: string;\n stateId?: string;\n estimate?: number;\n dueDate?: Date;\n}\n\nexport interface LinearCommentInput {\n body: string;\n issueId: string;\n}\n\nexport interface LinearSearchFilters {\n state?: string[];\n assignee?: string[];\n label?: string[];\n project?: string;\n team?: string;\n priority?: number[];\n query?: string;\n limit?: number;\n}\n\n// Error classes specific to Linear\nexport class LinearAPIError extends Error {\n constructor(\n message: string,\n public status?: number,\n public response?: any\n ) {\n super(message);\n this.name = 'LinearAPIError';\n }\n}\n\nexport class LinearAuthenticationError extends LinearAPIError {\n constructor(message: string) {\n super(message, 401);\n this.name = 'LinearAuthenticationError';\n }\n}\n\nexport class LinearRateLimitError extends LinearAPIError {\n constructor(\n message: string,\n public resetTime: number\n ) {\n super(message, 429);\n this.name = 'LinearRateLimitError';\n }\n} ","import {\n Action,\n ActionResult,\n IAgentRuntime,\n Memory,\n State,\n ModelType,\n logger,\n HandlerCallback,\n} from '@elizaos/core';\nimport { LinearService } from '../services/linear';\nimport type { LinearIssueInput } from '../types';\n\nconst createIssueTemplate = `Given the user's request, extract the information needed to create a Linear issue.\n\nUser request: \"{{userMessage}}\"\n\nExtract and return ONLY a JSON object (no markdown formatting, no code blocks) with the following structure:\n{\n \"title\": \"Brief, clear issue title\",\n \"description\": \"Detailed description of the issue (optional, omit or use null if not provided)\",\n \"teamKey\": \"Team key if mentioned (e.g., ENG, PROD) - omit or use null if not mentioned\",\n \"priority\": \"Priority level if mentioned (1=urgent, 2=high, 3=normal, 4=low) - omit or use null if not mentioned\",\n \"labels\": [\"label1\", \"label2\"] (if any labels are mentioned, empty array if none),\n \"assignee\": \"Assignee username or email if mentioned - omit or use null if not mentioned\"\n}\n\nReturn only the JSON object, no other text.`;\n\nexport const createIssueAction: Action = {\n name: 'CREATE_LINEAR_ISSUE',\n description: 'Create a new issue in Linear',\n similes: ['create-linear-issue', 'new-linear-issue', 'add-linear-issue'],\n \n examples: [[\n {\n name: 'User',\n content: {\n text: 'Create a new issue: Fix login button not working on mobile devices'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll create that issue for you in Linear.',\n actions: ['CREATE_LINEAR_ISSUE']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Create a bug report for the ENG team: API returns 500 error when updating user profile'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll create a bug report for the engineering team right away.',\n actions: ['CREATE_LINEAR_ISSUE']\n }\n }\n ]],\n \n async validate(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> {\n try {\n const apiKey = runtime.getSetting('LINEAR_API_KEY');\n return !!apiKey;\n } catch {\n return false;\n }\n },\n \n async handler(\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> {\n try {\n const linearService = runtime.getService<LinearService>('linear');\n if (!linearService) {\n throw new Error('Linear service not available');\n }\n \n const content = message.content.text;\n if (!content) {\n const errorMessage = 'Please provide a description for the issue.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n // Check if the message already has structured data\n const structuredData = _options?.issueData as Partial<LinearIssueInput> | undefined;\n \n let issueData: Partial<LinearIssueInput>;\n \n if (structuredData) {\n issueData = structuredData;\n } else {\n // Use LLM to extract issue information\n const prompt = createIssueTemplate.replace('{{userMessage}}', content);\n \n const response = await runtime.useModel(ModelType.TEXT_LARGE, {\n prompt: prompt\n });\n \n if (!response) {\n throw new Error('Failed to extract issue information');\n }\n \n try {\n // Strip markdown code blocks if present\n const cleanedResponse = response.replace(/^```(?:json)?\\n?/,'').replace(/\\n?```$/,'').trim();\n const parsed = JSON.parse(cleanedResponse);\n \n // Clean up parsed data - convert empty strings to undefined for fields that need it\n issueData = {\n title: parsed.title || undefined,\n description: parsed.description || undefined,\n priority: parsed.priority ? Number(parsed.priority) : undefined,\n };\n \n // Handle team assignment\n if (parsed.teamKey) {\n const teams = await linearService.getTeams();\n const team = teams.find(t => \n t.key.toLowerCase() === parsed.teamKey.toLowerCase()\n );\n if (team) {\n issueData.teamId = team.id;\n }\n }\n \n // Handle assignee\n if (parsed.assignee && parsed.assignee !== '') {\n // Clean up assignee - remove @ symbol if present\n const cleanAssignee = parsed.assignee.replace(/^@/, '');\n \n const users = await linearService.getUsers();\n const user = users.find(u => \n u.email === cleanAssignee || \n u.name.toLowerCase().includes(cleanAssignee.toLowerCase())\n );\n if (user) {\n issueData.assigneeId = user.id;\n }\n }\n \n // Handle labels\n if (parsed.labels && Array.isArray(parsed.labels) && parsed.labels.length > 0) {\n const labels = await linearService.getLabels(issueData.teamId);\n const labelIds: string[] = [];\n \n for (const labelName of parsed.labels) {\n if (labelName && labelName !== '') {\n const label = labels.find(l => \n l.name.toLowerCase() === labelName.toLowerCase()\n );\n if (label) {\n labelIds.push(label.id);\n }\n }\n }\n \n if (labelIds.length > 0) {\n issueData.labelIds = labelIds;\n }\n }\n \n // If no team was specified, use the first available team as default\n if (!issueData.teamId) {\n // Check for default team key from environment\n const defaultTeamKey = runtime.getSetting('LINEAR_DEFAULT_TEAM_KEY') as string;\n \n if (defaultTeamKey) {\n const teams = await linearService.getTeams();\n const defaultTeam = teams.find(t => \n t.key.toLowerCase() === defaultTeamKey.toLowerCase()\n );\n if (defaultTeam) {\n issueData.teamId = defaultTeam.id;\n logger.info(`Using configured default team: ${defaultTeam.name} (${defaultTeam.key})`);\n } else {\n logger.warn(`Default team key ${defaultTeamKey} not found`);\n }\n }\n \n // If still no team, fall back to first available\n if (!issueData.teamId) {\n const teams = await linearService.getTeams();\n if (teams.length > 0) {\n issueData.teamId = teams[0].id;\n logger.warn(`No team specified, using first available team: ${teams[0].name}`);\n }\n }\n }\n } catch (parseError) {\n logger.error('Failed to parse LLM response:', parseError);\n // Fallback to simple title extraction\n issueData = {\n title: content.length > 100 ? content.substring(0, 100) + '...' : content,\n description: content\n };\n \n // Ensure we have a teamId even in fallback case\n const defaultTeamKey = runtime.getSetting('LINEAR_DEFAULT_TEAM_KEY') as string;\n const teams = await linearService.getTeams();\n \n if (defaultTeamKey) {\n const defaultTeam = teams.find(t => \n t.key.toLowerCase() === defaultTeamKey.toLowerCase()\n );\n if (defaultTeam) {\n issueData.teamId = defaultTeam.id;\n logger.info(`Using configured default team for fallback: ${defaultTeam.name} (${defaultTeam.key})`);\n }\n }\n \n if (!issueData.teamId && teams.length > 0) {\n issueData.teamId = teams[0].id;\n logger.warn(`Using first available team for fallback: ${teams[0].name}`);\n }\n }\n }\n \n if (!issueData.title) {\n const errorMessage = 'Could not determine issue title. Please provide more details.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n // Final check for required teamId\n if (!issueData.teamId) {\n const errorMessage = 'No Linear teams found. Please ensure at least one team exists in your Linear workspace.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n const issue = await linearService.createIssue(issueData as LinearIssueInput);\n \n // Send success message to channel\n const successMessage = `✅ Created Linear issue: ${issue.title} (${issue.identifier})\\n\\nView it at: ${issue.url}`;\n await callback?.({\n text: successMessage,\n source: message.content.source\n });\n \n return {\n text: `Created issue: ${issue.title} (${issue.identifier})`,\n success: true,\n data: {\n issueId: issue.id,\n identifier: issue.identifier,\n url: issue.url\n }\n };\n } catch (error) {\n logger.error('Failed to create issue:', error);\n const errorMessage = `❌ Failed to create issue: ${error instanceof Error ? error.message : 'Unknown error'}`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n }\n}; ","import { Action, ActionResult, IAgentRuntime, Memory, State, logger, HandlerCallback } from '@elizaos/core';\nimport { LinearService } from '../services/linear';\n\nexport const getIssueAction: Action = {\n name: 'GET_LINEAR_ISSUE',\n description: 'Get details of a specific Linear issue',\n similes: ['get-linear-issue', 'show-linear-issue', 'view-linear-issue'],\n \n examples: [[\n {\n name: 'User',\n content: {\n text: 'Show me issue ENG-123'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll get the details for issue ENG-123.',\n actions: ['GET_LINEAR_ISSUE']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'What\\'s the status of BUG-456?'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'Let me check the status of BUG-456 for you.',\n actions: ['GET_LINEAR_ISSUE']\n }\n }\n ]],\n \n async validate(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> {\n try {\n const apiKey = runtime.getSetting('LINEAR_API_KEY');\n return !!apiKey;\n } catch {\n return false;\n }\n },\n \n async handler(\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> {\n try {\n const linearService = runtime.getService<LinearService>('linear');\n if (!linearService) {\n throw new Error('Linear service not available');\n }\n \n const content = message.content.text;\n if (!content) {\n const errorMessage = 'Please specify an issue ID.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n // Extract issue ID from the message\n const issueMatch = content.match(/(\\w+-\\d+)/);\n if (!issueMatch) {\n const errorMessage = 'Please provide a valid issue ID (e.g., ENG-123).';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n const issueId = issueMatch[1];\n const issue = await linearService.getIssue(issueId);\n \n const assignee = await issue.assignee;\n const state = await issue.state;\n const team = await issue.team;\n const labels = await issue.labels();\n const project = await issue.project;\n \n const issueDetails = {\n id: issue.id,\n identifier: issue.identifier,\n title: issue.title,\n description: issue.description,\n priority: issue.priority,\n priorityLabel: issue.priorityLabel,\n url: issue.url,\n createdAt: issue.createdAt,\n updatedAt: issue.updatedAt,\n dueDate: issue.dueDate,\n estimate: issue.estimate,\n assignee: assignee ? {\n id: assignee.id,\n name: assignee.name,\n email: assignee.email,\n } : null,\n state: state ? {\n id: state.id,\n name: state.name,\n type: state.type,\n color: state.color,\n } : null,\n team: team ? {\n id: team.id,\n name: team.name,\n key: team.key,\n } : null,\n labels: labels.nodes.map(label => ({\n id: label.id,\n name: label.name,\n color: label.color,\n })),\n project: project ? {\n id: project.id,\n name: project.name,\n } : null,\n };\n \n // Format the response text\n let responseText = `📋 Issue ${issue.identifier}: ${issue.title}\\n`;\n responseText += `Status: ${state?.name || 'Unknown'}\\n`;\n responseText += `Priority: ${issue.priorityLabel}\\n`;\n if (assignee) {\n responseText += `Assignee: ${assignee.name}\\n`;\n }\n if (issue.dueDate) {\n responseText += `Due: ${new Date(issue.dueDate).toLocaleDateString()}\\n`;\n }\n if (issue.description) {\n responseText += `\\nDescription: ${issue.description}\\n`;\n }\n responseText += `\\nView in Linear: ${issue.url}`;\n \n // Send the formatted issue details to the channel\n await callback?.({\n text: responseText,\n source: message.content.source\n });\n \n return {\n text: responseText,\n success: true,\n data: issueDetails\n };\n } catch (error) {\n logger.error('Failed to get issue:', error);\n const errorMessage = `❌ Failed to get issue: ${error instanceof Error ? error.message : 'Unknown error'}`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n }\n}; ","import { Action, ActionResult, IAgentRuntime, Memory, State, logger, HandlerCallback, ModelType } from '@elizaos/core';\nimport { LinearService } from '../services/linear';\nimport type { LinearIssueInput } from '../types';\n\nconst updateIssueTemplate = `Given the user's request to update a Linear issue, extract the information needed.\n\nUser request: \"{{userMessage}}\"\n\nExtract and return ONLY a JSON object (no markdown formatting, no code blocks) with the following structure:\n{\n \"issueId\": \"The issue identifier (e.g., ENG-123, COM2-7)\",\n \"updates\": {\n \"title\": \"New title if changing the title\",\n \"description\": \"New description if changing the description\",\n \"priority\": \"Priority level if changing (1=urgent, 2=high, 3=normal, 4=low)\",\n \"teamKey\": \"New team key if moving to another team (e.g., ENG, ELIZA, COM2)\",\n \"assignee\": \"New assignee username or email if changing\",\n \"status\": \"New status if changing (e.g., todo, in-progress, done, canceled)\",\n \"labels\": [\"label1\", \"label2\"] (if changing labels, empty array to clear)\n }\n}\n\nOnly include fields that are being updated. Return only the JSON object, no other text.`;\n\nexport const updateIssueAction: Action = {\n name: 'UPDATE_LINEAR_ISSUE',\n description: 'Update an existing Linear issue',\n similes: ['update-linear-issue', 'edit-linear-issue', 'modify-linear-issue', 'move-linear-issue', 'change-linear-issue'],\n \n examples: [[\n {\n name: 'User',\n content: {\n text: 'Update issue ENG-123 title to \"Fix login button on all devices\"'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll update the title of issue ENG-123 for you.',\n actions: ['UPDATE_LINEAR_ISSUE']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Move issue COM2-7 to the ELIZA team'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll move issue COM2-7 to the ELIZA team.',\n actions: ['UPDATE_LINEAR_ISSUE']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Change the priority of BUG-456 to high and assign to john@example.com'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll change the priority of BUG-456 to high and assign it to john@example.com.',\n actions: ['UPDATE_LINEAR_ISSUE']\n }\n }\n ]],\n \n async validate(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> {\n try {\n const apiKey = runtime.getSetting('LINEAR_API_KEY');\n return !!apiKey;\n } catch {\n return false;\n }\n },\n \n async handler(\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> {\n try {\n const linearService = runtime.getService<LinearService>('linear');\n if (!linearService) {\n throw new Error('Linear service not available');\n }\n \n const content = message.content.text;\n if (!content) {\n const errorMessage = 'Please provide update instructions for the issue.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n // Use LLM to extract update information\n const prompt = updateIssueTemplate.replace('{{userMessage}}', content);\n \n const response = await runtime.useModel(ModelType.TEXT_LARGE, {\n prompt: prompt\n });\n \n if (!response) {\n throw new Error('Failed to extract update information');\n }\n \n let issueId: string;\n let updates: Partial<LinearIssueInput> = {};\n \n try {\n // Strip markdown code blocks if present\n const cleanedResponse = response.replace(/^```(?:json)?\\n?/,'').replace(/\\n?```$/,'').trim();\n const parsed = JSON.parse(cleanedResponse);\n \n issueId = parsed.issueId;\n if (!issueId) {\n throw new Error('Issue ID not found in parsed response');\n }\n \n // Handle title update\n if (parsed.updates?.title) {\n updates.title = parsed.updates.title;\n }\n \n // Handle description update\n if (parsed.updates?.description) {\n updates.description = parsed.updates.description;\n }\n \n // Handle priority update\n if (parsed.updates?.priority) {\n updates.priority = Number(parsed.updates.priority);\n }\n \n // Handle team change\n if (parsed.updates?.teamKey) {\n const teams = await linearService.getTeams();\n const team = teams.find(t => \n t.key.toLowerCase() === parsed.updates.teamKey.toLowerCase()\n );\n if (team) {\n updates.teamId = team.id;\n logger.info(`Moving issue to team: ${team.name} (${team.key})`);\n } else {\n logger.warn(`Team with key ${parsed.updates.teamKey} not found`);\n }\n }\n \n // Handle assignee update\n if (parsed.updates?.assignee) {\n const cleanAssignee = parsed.updates.assignee.replace(/^@/, '');\n const users = await linearService.getUsers();\n const user = users.find(u => \n u.email === cleanAssignee || \n u.name.toLowerCase().includes(cleanAssignee.toLowerCase())\n );\n if (user) {\n updates.assigneeId = user.id;\n } else {\n logger.warn(`User ${cleanAssignee} not found`);\n }\n }\n \n // Handle status update\n if (parsed.updates?.status) {\n // Get the workflow states for the target team (or current team if not changing)\n const issue = await linearService.getIssue(issueId);\n const issueTeam = await issue.team;\n const teamId = updates.teamId || issueTeam?.id;\n if (!teamId) {\n logger.warn('Could not determine team for status update');\n } else {\n const states = await linearService.getWorkflowStates(teamId);\n \n const state = states.find(s => \n s.name.toLowerCase() === parsed.updates.status.toLowerCase() ||\n s.type.toLowerCase() === parsed.updates.status.toLowerCase()\n );\n \n if (state) {\n updates.stateId = state.id;\n logger.info(`Changing status to: ${state.name}`);\n } else {\n logger.warn(`Status ${parsed.updates.status} not found for team`);\n }\n }\n }\n \n // Handle labels update\n if (parsed.updates?.labels && Array.isArray(parsed.updates.labels)) {\n const teamId = updates.teamId;\n const labels = await linearService.getLabels(teamId);\n const labelIds: string[] = [];\n \n for (const labelName of parsed.updates.labels) {\n if (labelName) {\n const label = labels.find(l => \n l.name.toLowerCase() === labelName.toLowerCase()\n );\n if (label) {\n labelIds.push(label.id);\n }\n }\n }\n \n updates.labelIds = labelIds;\n }\n \n } catch (parseError) {\n // Fallback to regex parsing for simple cases\n logger.warn('Failed to parse LLM response, falling back to regex parsing:', parseError);\n \n const issueMatch = content.match(/(\\w+-\\d+)/);\n if (!issueMatch) {\n const errorMessage = 'Please specify an issue ID (e.g., ENG-123) to update.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n issueId = issueMatch[1];\n \n // Simple regex patterns for common updates\n const titleMatch = content.match(/title to [\"'](.+?)[\"']/i);\n if (titleMatch) {\n updates.title = titleMatch[1];\n }\n \n const priorityMatch = content.match(/priority (?:to |as )?(\\w+)/i);\n if (priorityMatch) {\n const priorityMap: Record<string, number> = {\n 'urgent': 1,\n 'high': 2,\n 'normal': 3,\n 'medium': 3,\n 'low': 4,\n };\n const priority = priorityMap[priorityMatch[1].toLowerCase()];\n if (priority) {\n updates.priority = priority;\n }\n }\n }\n \n if (Object.keys(updates).length === 0) {\n const errorMessage = 'No valid updates found. Please specify what to update (e.g., \"Update issue ENG-123 title to \\'New Title\\'\")';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n const updatedIssue = await linearService.updateIssue(issueId, updates);\n \n const updateSummary = [];\n if (updates.title) updateSummary.push(`title: \"${updates.title}\"`);\n if (updates.priority) updateSummary.push(`priority: ${['', 'urgent', 'high', 'normal', 'low'][updates.priority]}`);\n if (updates.teamId) updateSummary.push(`moved to team`);\n if (updates.assigneeId) updateSummary.push(`assigned to user`);\n if (updates.stateId) updateSummary.push(`status changed`);\n if (updates.labelIds) updateSummary.push(`labels updated`);\n \n const successMessage = `✅ Updated issue ${updatedIssue.identifier}: ${updateSummary.join(', ')}\\n\\nView it at: ${updatedIssue.url}`;\n await callback?.({\n text: successMessage,\n source: message.content.source\n });\n \n return {\n text: `Updated issue ${updatedIssue.identifier}: ${updateSummary.join(', ')}`,\n success: true,\n data: {\n issueId: updatedIssue.id,\n identifier: updatedIssue.identifier,\n updates,\n url: updatedIssue.url\n }\n };\n } catch (error) {\n logger.error('Failed to update issue:', error);\n const errorMessage = `❌ Failed to update issue: ${error instanceof Error ? error.message : 'Unknown error'}`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n }\n}; ","import {\n Action,\n ActionResult,\n IAgentRuntime,\n Memory,\n State,\n ModelType,\n logger,\n HandlerCallback,\n} from '@elizaos/core';\nimport { LinearService } from '../services/linear';\nimport type { LinearSearchFilters } from '../types';\n\nconst searchTemplate = `Extract search criteria from the user's request for Linear issues.\n\nUser request: \"{{userMessage}}\"\n\nExtract and return ONLY a JSON object (no markdown formatting, no code blocks) with these possible filters:\n{\n \"query\": \"general search text\",\n \"state\": \"filter by state name (e.g., 'In Progress', 'Done', 'Todo')\",\n \"assignee\": \"filter by assignee name or email\",\n \"priority\": \"filter by priority (1=urgent, 2=high, 3=normal, 4=low)\",\n \"team\": \"filter by team name or key\",\n \"label\": \"filter by label name\",\n \"hasAssignee\": true/false - whether issue should have an assignee,\n \"limit\": number of results to return (default 10)\n}\n\nOnly include fields that are mentioned. Return only the JSON object.`;\n\nexport const searchIssuesAction: Action = {\n name: 'SEARCH_LINEAR_ISSUES',\n description: 'Search for issues in Linear with various filters',\n similes: ['search-linear-issues', 'find-linear-issues', 'query-linear-issues'],\n \n examples: [[\n {\n name: 'User',\n content: {\n text: 'Show me all open bugs'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll search for all open bug issues in Linear.',\n actions: ['SEARCH_LINEAR_ISSUES']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Find high priority issues assigned to me'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll search for high priority issues assigned to you.',\n actions: ['SEARCH_LINEAR_ISSUES']\n }\n }\n ]],\n \n async validate(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> {\n try {\n const apiKey = runtime.getSetting('LINEAR_API_KEY');\n return !!apiKey;\n } catch {\n return false;\n }\n },\n \n async handler(\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> {\n try {\n const linearService = runtime.getService<LinearService>('linear');\n if (!linearService) {\n throw new Error('Linear service not available');\n }\n \n const content = message.content.text;\n if (!content) {\n const errorMessage = 'Please provide search criteria for issues.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n let filters: LinearSearchFilters = {};\n \n // Check if we have explicit filters in options\n if (_options?.filters) {\n filters = _options.filters as LinearSearchFilters;\n } else {\n // Use LLM to extract search filters\n const prompt = searchTemplate.replace('{{userMessage}}', content);\n \n const response = await runtime.useModel(ModelType.TEXT_LARGE, {\n prompt: prompt\n });\n \n if (!response) {\n // Fallback to simple keyword search\n filters = { query: content };\n } else {\n try {\n // Strip markdown code blocks if present\n const cleanedResponse = response.replace(/^```(?:json)?\\n?/,'').replace(/\\n?```$/,'').trim();\n const parsed = JSON.parse(cleanedResponse);\n filters = {\n query: parsed.query,\n state: parsed.state ? [parsed.state] : undefined,\n assignee: parsed.assignee ? [parsed.assignee] : undefined,\n priority: parsed.priority ? [parsed.priority] : undefined,\n team: parsed.team,\n label: parsed.label ? [parsed.label] : undefined,\n limit: parsed.limit\n };\n \n // Clean up undefined values\n Object.keys(filters).forEach(key => {\n if (filters[key as keyof LinearSearchFilters] === undefined) {\n delete filters[key as keyof LinearSearchFilters];\n }\n });\n } catch (parseError) {\n logger.error('Failed to parse search filters:', parseError);\n // Fallback to simple search\n filters = { query: content };\n }\n }\n }\n \n filters.limit = (_options?.limit as number) || 10;\n const issues = await linearService.searchIssues(filters);\n \n if (issues.length === 0) {\n const noResultsMessage = 'No issues found matching your search criteria.';\n await callback?.({\n text: noResultsMessage,\n source: message.content.source\n });\n return {\n text: noResultsMessage,\n success: true,\n data: {\n issues: [],\n filters,\n count: 0\n }\n };\n }\n \n const issueList = await Promise.all(issues.map(async (issue, index) => {\n const state = await issue.state;\n return `${index + 1}. ${issue.identifier}: ${issue.title} (${state?.name || 'No state'})`;\n }));\n const issueText = issueList.join('\\n');\n \n const resultMessage = `📋 Found ${issues.length} issue${issues.length === 1 ? '' : 's'}:\\n${issueText}`;\n await callback?.({\n text: resultMessage,\n source: message.content.source\n });\n \n return {\n text: `Found ${issues.length} issue${issues.length === 1 ? '' : 's'}:\\n${issueText}`,\n success: true,\n data: {\n issues: issues.map(i => ({\n id: i.id,\n identifier: i.identifier,\n title: i.title,\n description: i.description,\n url: i.url,\n state: i.state,\n priority: i.priority,\n priorityLabel: i.priorityLabel,\n assignee: i.assignee\n })),\n filters,\n count: issues.length\n }\n };\n } catch (error) {\n logger.error('Failed to search issues:', error);\n const errorMessage = `❌ Failed to search issues: ${error instanceof Error ? error.message : 'Unknown error'}`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n }\n}; ","import { Action, ActionResult, IAgentRuntime, Memory, State, ActionExample, logger, HandlerCallback } from '@elizaos/core';\nimport { LinearService } from '../services/linear';\n\nexport const createCommentAction: Action = {\n name: 'CREATE_LINEAR_COMMENT',\n description: 'Create a comment on a Linear issue',\n similes: ['create-linear-comment', 'add-linear-comment', 'comment-on-linear-issue'],\n \n examples: [[\n {\n name: 'User',\n content: {\n text: 'Comment on ENG-123: This has been fixed in the latest release'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll add that comment to issue ENG-123.',\n actions: ['CREATE_LINEAR_COMMENT']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Add a comment to BUG-456: Need more information from the reporter'\n }\n },\n {\n name: 'Assistant', \n content: {\n text: 'I\\'ll post that comment on BUG-456 right away.',\n actions: ['CREATE_LINEAR_COMMENT']\n }\n }\n ]],\n \n async validate(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> {\n try {\n const apiKey = runtime.getSetting('LINEAR_API_KEY');\n return !!apiKey;\n } catch {\n return false;\n }\n },\n \n async handler(\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> {\n try {\n const linearService = runtime.getService<LinearService>('linear');\n if (!linearService) {\n throw new Error('Linear service not available');\n }\n \n const content = message.content.text;\n if (!content) {\n const errorMessage = 'Please provide a message with the issue ID and comment content.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n const issueMatch = content.match(/(?:comment on|add.*comment.*to)\\s+(\\w+-\\d+):?\\s*(.*)/i);\n \n if (!issueMatch) {\n const errorMessage = 'Please specify the issue ID and comment content. Example: \"Comment on ENG-123: This looks good\"';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n const [, issueIdentifier, commentBody] = issueMatch;\n \n // Find the issue first to get its ID\n const issue = await linearService.getIssue(issueIdentifier);\n \n const comment = await linearService.createComment({\n issueId: issue.id,\n body: commentBody.trim()\n });\n \n const successMessage = `✅ Comment added to issue ${issueIdentifier}: \"${commentBody.trim()}\"`;\n await callback?.({\n text: successMessage,\n source: message.content.source\n });\n \n return {\n text: `Comment added to issue ${issueIdentifier}: \"${commentBody.trim()}\"`,\n success: true,\n data: {\n commentId: comment.id,\n issueId: issue.id\n }\n };\n } catch (error) {\n logger.error('Failed to create comment:', error);\n const errorMessage = `❌ Failed to create comment: ${error instanceof Error ? error.message : 'Unknown error'}`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n }\n}; ","import { Action, ActionResult, IAgentRuntime, Memory, State, logger, HandlerCallback } from '@elizaos/core';\nimport { LinearService } from '../services/linear';\n\nexport const listTeamsAction: Action = {\n name: 'LIST_LINEAR_TEAMS',\n description: 'List all teams in Linear',\n similes: ['list-linear-teams', 'show-linear-teams', 'get-linear-teams'],\n \n examples: [[\n {\n name: 'User',\n content: {\n text: 'Show me all teams'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll list all the teams in Linear for you.',\n actions: ['LIST_LINEAR_TEAMS']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'What teams are available?'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'Let me show you all the available teams.',\n actions: ['LIST_LINEAR_TEAMS']\n }\n }\n ]],\n \n async validate(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> {\n try {\n const apiKey = runtime.getSetting('LINEAR_API_KEY');\n return !!apiKey;\n } catch {\n return false;\n }\n },\n \n async handler(\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> {\n try {\n const linearService = runtime.getService<LinearService>('linear');\n if (!linearService) {\n throw new Error('Linear service not available');\n }\n \n const teams = await linearService.getTeams();\n \n if (teams.length === 0) {\n const noTeamsMessage = 'No teams found in Linear.';\n await callback?.({\n text: noTeamsMessage,\n source: message.content.source\n });\n return {\n text: noTeamsMessage,\n success: true,\n data: {\n teams: []\n }\n };\n }\n \n const teamList = teams.map((team, index) => \n `${index + 1}. ${team.name} (${team.key})${team.description ? ` - ${team.description}` : ''}`\n ).join('\\n');\n \n const resultMessage = `👥 Found ${teams.length} team${teams.length === 1 ? '' : 's'}:\\n${teamList}`;\n await callback?.({\n text: resultMessage,\n source: message.content.source\n });\n \n return {\n text: `Found ${teams.length} team${teams.length === 1 ? '' : 's'}:\\n${teamList}`,\n success: true,\n data: {\n teams: teams.map(t => ({\n id: t.id,\n name: t.name,\n key: t.key,\n description: t.description\n })),\n count: teams.length\n }\n };\n } catch (error) {\n logger.error('Failed to list teams:', error);\n const errorMessage = `❌ Failed to list teams: ${error instanceof Error ? error.message : 'Unknown error'}`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n }\n}; ","import { Action, ActionResult, IAgentRuntime, Memory, State, logger, HandlerCallback } from '@elizaos/core';\nimport { LinearService } from '../services/linear';\n\nexport const listProjectsAction: Action = {\n name: 'LIST_LINEAR_PROJECTS',\n description: 'List all projects in Linear',\n similes: ['list-linear-projects', 'show-linear-projects', 'get-linear-projects'],\n \n examples: [[\n {\n name: 'User',\n content: {\n text: 'Show me all projects'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll list all the projects in Linear for you.',\n actions: ['LIST_LINEAR_PROJECTS']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'What projects do we have?'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'Let me show you all the available projects.',\n actions: ['LIST_LINEAR_PROJECTS']\n }\n }\n ]],\n \n async validate(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> {\n try {\n const apiKey = runtime.getSetting('LINEAR_API_KEY');\n return !!apiKey;\n } catch {\n return false;\n }\n },\n \n async handler(\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> {\n try {\n const linearService = runtime.getService<LinearService>('linear');\n if (!linearService) {\n throw new Error('Linear service not available');\n }\n \n const projects = await linearService.getProjects();\n \n if (projects.length === 0) {\n const noProjectsMessage = 'No projects found in Linear.';\n await callback?.({\n text: noProjectsMessage,\n source: message.content.source\n });\n return {\n text: noProjectsMessage,\n success: true,\n data: {\n projects: []\n }\n };\n }\n \n // Get teams for each project\n const projectsWithDetails = await Promise.all(\n projects.map(async (project) => {\n const teamsQuery = await project.teams();\n const teams = await teamsQuery.nodes;\n return {\n ...project,\n teamsList: teams\n };\n })\n );\n \n const projectList = projectsWithDetails.map((project, index) => {\n const teamNames = project.teamsList.map((t: any) => t.name).join(', ') || 'No teams';\n return `${index + 1}. ${project.name}${project.description ? ` - ${project.description}` : ''} (Teams: ${teamNames})`;\n }).join('\\n');\n \n const resultMessage = `📁 Found ${projects.length} project${projects.length === 1 ? '' : 's'}:\\n${projectList}`;\n await callback?.({\n text: resultMessage,\n source: message.content.source\n });\n \n return {\n text: `Found ${projects.length} project${projects.length === 1 ? '' : 's'}:\\n${projectList}`,\n success: true,\n data: {\n projects: projectsWithDetails.map(p => ({\n id: p.id,\n name: p.name,\n description: p.description,\n url: p.url,\n teams: p.teamsList.map((t: any) => ({\n id: t.id,\n name: t.name,\n key: t.key\n })),\n state: p.state,\n progress: p.progress,\n startDate: p.startDate,\n targetDate: p.targetDate\n })),\n count: projects.length\n }\n };\n } catch (error) {\n logger.error('Failed to list projects:', error);\n const errorMessage = `❌ Failed to list projects: ${error instanceof Error ? error.message : 'Unknown error'}`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n }\n}; ","import { Action, ActionResult, IAgentRuntime, Memory, State, logger, HandlerCallback } from '@elizaos/core';\nimport { LinearService } from '../services/linear';\n\nexport const getActivityAction: Action = {\n name: 'GET_LINEAR_ACTIVITY',\n description: 'Get recent Linear activity',\n similes: ['get-linear-activity', 'show-linear-activity', 'view-linear-activity'],\n \n examples: [[\n {\n name: 'User',\n content: {\n text: 'Show me recent Linear activity'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll check the recent Linear activity for you.',\n actions: ['GET_LINEAR_ACTIVITY']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'What\\'s been happening in Linear?'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'Let me show you the recent Linear activity.',\n actions: ['GET_LINEAR_ACTIVITY']\n }\n }\n ]],\n \n async validate(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> {\n try {\n const apiKey = runtime.getSetting('LINEAR_API_KEY');\n return !!apiKey;\n } catch {\n return false;\n }\n },\n \n async handler(\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> {\n try {\n const linearService = runtime.getService<LinearService>('linear');\n if (!linearService) {\n throw new Error('Linear service not available');\n }\n \n const activity = linearService.getActivityLog();\n \n if (activity.length === 0) {\n const noActivityMessage = 'No recent Linear activity found.';\n await callback?.({\n text: noActivityMessage,\n source: message.content.source\n });\n return {\n text: noActivityMessage,\n success: true,\n data: {\n activity: []\n }\n };\n }\n \n const activityText = activity\n .slice(0, 10) // Show last 10 activities\n .map((item, index) => {\n const description = `${item.action} ${item.resource_type} ${item.resource_id}${item.error ? ` (failed: ${item.error})` : ''}`;\n return `${index + 1}. ${description}`;\n })\n .join('\\n');\n \n const resultMessage = `📊 Recent Linear activity:\\n${activityText}`;\n await callback?.({\n text: resultMessage,\n source: message.content.source\n });\n \n return {\n text: `Recent Linear activity:\\n${activityText}`,\n success: true,\n data: {\n activity: activity.slice(0, 10),\n count: activity.length\n }\n };\n } catch (error) {\n logger.error('Failed to get Linear activity:', error);\n const errorMessage = `❌ Failed to get Linear activity: ${error instanceof Error ? error.message : 'Unknown error'}`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n }\n}; ","import { Action, ActionResult, IAgentRuntime, Memory, State, ActionExample, logger, HandlerCallback } from '@elizaos/core';\nimport { LinearService } from '../services/linear';\n\nexport const clearActivityAction: Action = {\n name: 'CLEAR_LINEAR_ACTIVITY',\n description: 'Clear the Linear activity log',\n similes: ['clear-linear-activity', 'reset-linear-activity', 'delete-linear-activity'],\n \n examples: [[\n {\n name: 'User',\n content: {\n text: 'Clear the Linear activity log'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll clear the Linear activity log for you.',\n actions: ['CLEAR_LINEAR_ACTIVITY']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Reset Linear activity'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll reset the Linear activity log now.',\n actions: ['CLEAR_LINEAR_ACTIVITY']\n }\n }\n ]],\n \n async validate(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> {\n try {\n const apiKey = runtime.getSetting('LINEAR_API_KEY');\n return !!apiKey;\n } catch {\n return false;\n }\n },\n \n async handler(\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> {\n try {\n const linearService = runtime.getService<LinearService>('linear');\n if (!linearService) {\n throw new Error('Linear service not available');\n }\n \n await linearService.clearActivityLog();\n \n const successMessage = '✅ Linear activity log has been cleared.';\n await callback?.({\n text: successMessage,\n source: message.content.source\n });\n \n return {\n text: successMessage,\n success: true\n };\n } catch (error) {\n logger.error('Failed to clear Linear activity:', error);\n const errorMessage = `❌ Failed to clear Linear activity: ${error instanceof Error ? error.message : 'Unknown error'}`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n }\n}; ","import { Plugin } from '@elizaos/core';\nimport { LinearService } from './services/linear';\n\n// Import all actions\nimport { createIssueAction } from './actions/createIssue';\nimport { getIssueAction } from './actions/getIssue';\nimport { updateIssueAction } from './actions/updateIssue';\nimport { searchIssuesAction } from './actions/searchIssues';\nimport { createCommentAction } from './actions/createComment';\nimport { listTeamsAction } from './actions/listTeams';\nimport { listProjectsAction } from './actions/listProjects';\nimport { getActivityAction } from './actions/getActivity';\nimport { clearActivityAction } from './actions/clearActivity';\n\n// Import all providers\n// import { linearIssuesProvider } from './providers/issues';\n// import { linearTeamsProvider } from './providers/teams';\n// import { linearProjectsProvider } from './providers/projects';\n// import { linearActivityProvider } from './providers/activity';\n\nexport const linearPlugin: Plugin = {\n name: '@elizaos/plugin-linear',\n description: 'Plugin for integrating with Linear issue tracking system',\n services: [LinearService],\n actions: [\n createIssueAction,\n getIssueAction,\n updateIssueAction,\n searchIssuesAction,\n createCommentAction,\n listTeamsAction,\n listProjectsAction,\n getActivityAction,\n clearActivityAction,\n ],\n providers: [\n // linearIssuesProvider,\n // linearTeamsProvider,\n // linearProjectsProvider,\n // linearActivityProvider,\n ],\n};\n\n// Re-export types and service for external use\nexport * from './types';\nexport { LinearService } from './services/linear'; "],"mappings":";AAAA,SAAS,QAAQ,eAAmC;AACpD,SAAS,oBAAoF;;;AC6CtF,IAAM,iBAAN,cAA6B,MAAM;AAAA,EACxC,YACE,SACO,QACA,UACP;AACA,UAAM,OAAO;AAHN;A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AAI,MAAM,8BAA8B;AAAA,MAChD;AAEA,YAAM,cAAc,iBAAiB;AAErC,YAAM,iBAAiB;AACvB,YAAM,WAAW;AAAA,QACf,MAAM;AAAA,QACN,QAAQ,QAAQ,QAAQ;AAAA,MAC1B,CAAC;AAED,aAAO;AAAA,QACL,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,IACF,SAAS,OAAO;AACd,MAAAA,SAAO,MAAM,oCAAoC,KAAK;AACtD,YAAM,eAAe,2CAAsC,iBAAiB,QAAQ,MAAM,UAAU,eAAe;AACnH,YAAM,WAAW;AAAA,QACf,MAAM;AAAA,QACN,QAAQ,QAAQ,QAAQ;AAAA,MAC1B,CAAC;AACD,aAAO;AAAA,QACL,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AACF;;;ACjEO,IAAM,eAAuB;AAAA,EAClC,MAAM;AAAA,EACN,aAAa;AAAA,EACb,UAAU,CAAC,aAAa;AAAA,EACxB,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA,EAKX;AACF;","names":["logger","logger","logger","ModelType","ModelType","logger","logger","logger","logger","logger","logger"]}
|
|
1
|
+
{"version":3,"sources":["../src/services/linear.ts","../src/types/index.ts","../src/actions/createIssue.ts","../src/actions/getIssue.ts","../src/actions/updateIssue.ts","../src/actions/deleteIssue.ts","../src/actions/searchIssues.ts","../src/actions/createComment.ts","../src/actions/listTeams.ts","../src/actions/listProjects.ts","../src/actions/getActivity.ts","../src/actions/clearActivity.ts","../src/index.ts"],"sourcesContent":["import { logger, Service, type IAgentRuntime } from '@elizaos/core';\nimport { LinearClient, Issue, Project, Team, User, WorkflowState, IssueLabel, Comment } from '@linear/sdk';\nimport type { \n LinearConfig, \n LinearActivityItem, \n LinearIssueInput, \n LinearCommentInput,\n LinearSearchFilters \n} from '../types';\nimport { LinearAPIError, LinearAuthenticationError } from '../types';\n\nexport class LinearService extends Service {\n static serviceType = 'linear';\n \n capabilityDescription = 'Linear API integration for issue tracking, project management, and team collaboration';\n \n private client: LinearClient;\n private activityLog: LinearActivityItem[] = [];\n private linearConfig: LinearConfig;\n private workspaceId?: string;\n \n constructor(runtime?: IAgentRuntime) {\n super(runtime);\n \n // Get config from runtime settings\n const apiKey = runtime?.getSetting('LINEAR_API_KEY') as string;\n const workspaceId = runtime?.getSetting('LINEAR_WORKSPACE_ID') as string;\n \n if (!apiKey) {\n throw new LinearAuthenticationError('Linear API key is required');\n }\n \n this.linearConfig = {\n LINEAR_API_KEY: apiKey,\n LINEAR_WORKSPACE_ID: workspaceId,\n };\n \n this.workspaceId = workspaceId;\n \n this.config = {\n LINEAR_API_KEY: apiKey,\n LINEAR_WORKSPACE_ID: workspaceId,\n };\n \n this.client = new LinearClient({\n apiKey: this.linearConfig.LINEAR_API_KEY,\n });\n }\n \n static async start(runtime: IAgentRuntime): Promise<LinearService> {\n const service = new LinearService(runtime);\n await service.validateConnection();\n logger.info('Linear service started successfully');\n return service;\n }\n \n async stop(): Promise<void> {\n this.activityLog = [];\n logger.info('Linear service stopped');\n }\n \n // Validate the API connection\n private async validateConnection(): Promise<void> {\n try {\n const viewer = await this.client.viewer;\n logger.info(`Linear connected as user: ${viewer.email}`);\n } catch (error) {\n throw new LinearAuthenticationError('Failed to authenticate with Linear API');\n }\n }\n \n // Log activity\n private logActivity(\n action: string,\n resourceType: LinearActivityItem['resource_type'],\n resourceId: string,\n details: Record<string, any>,\n success: boolean,\n error?: string\n ): void {\n const activity: LinearActivityItem = {\n id: `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,\n timestamp: new Date().toISOString(),\n action,\n resource_type: resourceType,\n resource_id: resourceId,\n details,\n success,\n error,\n };\n \n this.activityLog.push(activity);\n \n // Keep only last 1000 activities\n if (this.activityLog.length > 1000) {\n this.activityLog = this.activityLog.slice(-1000);\n }\n }\n \n // Get activity log\n getActivityLog(limit?: number, filter?: Partial<LinearActivityItem>): LinearActivityItem[] {\n let filtered = [...this.activityLog];\n \n if (filter) {\n filtered = filtered.filter(item => {\n return Object.entries(filter).every(([key, value]) => {\n return item[key as keyof LinearActivityItem] === value;\n });\n });\n }\n \n return filtered.slice(-(limit || 100));\n }\n \n // Clear activity log\n clearActivityLog(): void {\n this.activityLog = [];\n logger.info('Linear activity log cleared');\n }\n \n // Team operations\n async getTeams(): Promise<Team[]> {\n try {\n const teams = await this.client.teams();\n const teamList = await teams.nodes;\n \n this.logActivity('list_teams', 'team', 'all', { count: teamList.length }, true);\n return teamList;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('list_teams', 'team', 'all', {}, false, errorMessage);\n throw new LinearAPIError(`Failed to fetch teams: ${errorMessage}`);\n }\n }\n \n async getTeam(teamId: string): Promise<Team> {\n try {\n const team = await this.client.team(teamId);\n this.logActivity('get_team', 'team', teamId, { name: team.name }, true);\n return team;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('get_team', 'team', teamId, {}, false, errorMessage);\n throw new LinearAPIError(`Failed to fetch team: ${errorMessage}`);\n }\n }\n \n // Issue operations\n async createIssue(input: LinearIssueInput): Promise<Issue> {\n try {\n const issuePayload = await this.client.createIssue({\n title: input.title,\n description: input.description,\n teamId: input.teamId,\n priority: input.priority,\n assigneeId: input.assigneeId,\n labelIds: input.labelIds,\n projectId: input.projectId,\n stateId: input.stateId,\n estimate: input.estimate,\n dueDate: input.dueDate,\n });\n \n const issue = await issuePayload.issue;\n if (!issue) {\n throw new Error('Failed to create issue');\n }\n \n this.logActivity('create_issue', 'issue', issue.id, { \n title: input.title,\n teamId: input.teamId \n }, true);\n \n return issue;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('create_issue', 'issue', 'new', input, false, errorMessage);\n throw new LinearAPIError(`Failed to create issue: ${errorMessage}`);\n }\n }\n \n async getIssue(issueId: string): Promise<Issue> {\n try {\n const issue = await this.client.issue(issueId);\n this.logActivity('get_issue', 'issue', issueId, { \n title: issue.title,\n identifier: issue.identifier \n }, true);\n return issue;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('get_issue', 'issue', issueId, {}, false, errorMessage);\n throw new LinearAPIError(`Failed to fetch issue: ${errorMessage}`);\n }\n }\n \n async updateIssue(issueId: string, updates: Partial<LinearIssueInput>): Promise<Issue> {\n try {\n const updatePayload = await this.client.updateIssue(issueId, {\n title: updates.title,\n description: updates.description,\n priority: updates.priority,\n assigneeId: updates.assigneeId,\n labelIds: updates.labelIds,\n projectId: updates.projectId,\n stateId: updates.stateId,\n estimate: updates.estimate,\n dueDate: updates.dueDate,\n });\n \n const issue = await updatePayload.issue;\n if (!issue) {\n throw new Error('Failed to update issue');\n }\n \n this.logActivity('update_issue', 'issue', issueId, updates, true);\n return issue;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('update_issue', 'issue', issueId, updates, false, errorMessage);\n throw new LinearAPIError(`Failed to update issue: ${errorMessage}`);\n }\n }\n \n async deleteIssue(issueId: string): Promise<void> {\n try {\n // In Linear, we archive issues rather than delete them\n const archivePayload = await this.client.archiveIssue(issueId);\n \n const success = await archivePayload.success;\n if (!success) {\n throw new Error('Failed to archive issue');\n }\n \n this.logActivity('delete_issue', 'issue', issueId, { action: 'archived' }, true);\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('delete_issue', 'issue', issueId, { action: 'archive_failed' }, false, errorMessage);\n throw new LinearAPIError(`Failed to archive issue: ${errorMessage}`);\n }\n }\n \n async searchIssues(filters: LinearSearchFilters): Promise<Issue[]> {\n try {\n // Build the filter object based on provided filters\n let filterObject: any = {};\n \n // Add text search filter\n if (filters.query) {\n filterObject.or = [\n { title: { containsIgnoreCase: filters.query } },\n { description: { containsIgnoreCase: filters.query } },\n ];\n }\n \n // Add team filter\n if (filters.team) {\n // First try to find the team by key or name\n const teams = await this.getTeams();\n const team = teams.find(t => \n t.key.toLowerCase() === filters.team?.toLowerCase() ||\n t.name.toLowerCase() === filters.team?.toLowerCase()\n );\n \n if (team) {\n filterObject.team = { id: { eq: team.id } };\n }\n }\n \n // Add assignee filter\n if (filters.assignee && filters.assignee.length > 0) {\n const users = await this.getUsers();\n const assigneeIds = filters.assignee.map(assigneeName => {\n const user = users.find(u => \n u.email === assigneeName || \n u.name.toLowerCase().includes(assigneeName.toLowerCase())\n );\n return user?.id;\n }).filter(Boolean);\n \n if (assigneeIds.length > 0) {\n filterObject.assignee = { id: { in: assigneeIds } };\n }\n }\n \n // Add priority filter\n if (filters.priority && filters.priority.length > 0) {\n filterObject.priority = { number: { in: filters.priority } };\n }\n \n // Add state filter\n if (filters.state && filters.state.length > 0) {\n filterObject.state = { \n name: { in: filters.state }\n };\n }\n \n // Add label filter\n if (filters.label && filters.label.length > 0) {\n filterObject.labels = {\n some: {\n name: { in: filters.label }\n }\n };\n }\n \n const query = this.client.issues({\n first: filters.limit || 50,\n filter: Object.keys(filterObject).length > 0 ? filterObject : undefined,\n });\n \n const issues = await query;\n const issueList = await issues.nodes;\n \n this.logActivity('search_issues', 'issue', 'search', { \n filters,\n count: issueList.length \n }, true);\n \n return issueList;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('search_issues', 'issue', 'search', filters, false, errorMessage);\n throw new LinearAPIError(`Failed to search issues: ${errorMessage}`);\n }\n }\n \n // Comment operations\n async createComment(input: LinearCommentInput): Promise<Comment> {\n try {\n const commentPayload = await this.client.createComment({\n body: input.body,\n issueId: input.issueId,\n });\n \n const comment = await commentPayload.comment;\n if (!comment) {\n throw new Error('Failed to create comment');\n }\n \n this.logActivity('create_comment', 'comment', comment.id, { \n issueId: input.issueId,\n bodyLength: input.body.length \n }, true);\n \n return comment;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('create_comment', 'comment', 'new', input, false, errorMessage);\n throw new LinearAPIError(`Failed to create comment: ${errorMessage}`);\n }\n }\n \n // Project operations\n async getProjects(teamId?: string): Promise<Project[]> {\n try {\n // Note: Linear SDK v51 may not support direct team filtering on projects\n // Get all projects and filter manually if needed\n const query = this.client.projects({\n first: 100,\n });\n \n const projects = await query;\n let projectList = await projects.nodes;\n \n // Manual filtering by team if teamId is provided\n if (teamId) {\n const filteredProjects = await Promise.all(\n projectList.map(async (project) => {\n const projectTeams = await project.teams();\n const teamsList = await projectTeams.nodes;\n const hasTeam = teamsList.some((team: any) => team.id === teamId);\n return hasTeam ? project : null;\n })\n );\n projectList = filteredProjects.filter(Boolean) as Project[];\n }\n \n this.logActivity('list_projects', 'project', 'all', { \n count: projectList.length,\n teamId \n }, true);\n \n return projectList;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('list_projects', 'project', 'all', { teamId }, false, errorMessage);\n throw new LinearAPIError(`Failed to fetch projects: ${errorMessage}`);\n }\n }\n \n async getProject(projectId: string): Promise<Project> {\n try {\n const project = await this.client.project(projectId);\n this.logActivity('get_project', 'project', projectId, { \n name: project.name \n }, true);\n return project;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('get_project', 'project', projectId, {}, false, errorMessage);\n throw new LinearAPIError(`Failed to fetch project: ${errorMessage}`);\n }\n }\n \n // User operations\n async getUsers(): Promise<User[]> {\n try {\n const users = await this.client.users();\n const userList = await users.nodes;\n \n this.logActivity('list_users', 'user', 'all', { \n count: userList.length \n }, true);\n \n return userList;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('list_users', 'user', 'all', {}, false, errorMessage);\n throw new LinearAPIError(`Failed to fetch users: ${errorMessage}`);\n }\n }\n \n async getCurrentUser(): Promise<User> {\n try {\n const user = await this.client.viewer;\n this.logActivity('get_current_user', 'user', user.id, { \n email: user.email,\n name: user.name \n }, true);\n return user;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('get_current_user', 'user', 'current', {}, false, errorMessage);\n throw new LinearAPIError(`Failed to fetch current user: ${errorMessage}`);\n }\n }\n \n // Label operations\n async getLabels(teamId?: string): Promise<IssueLabel[]> {\n try {\n const query = this.client.issueLabels({\n first: 100,\n filter: teamId ? {\n team: { id: { eq: teamId } },\n } : undefined,\n });\n \n const labels = await query;\n const labelList = await labels.nodes;\n \n this.logActivity('list_labels', 'label', 'all', { \n count: labelList.length,\n teamId \n }, true);\n \n return labelList;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('list_labels', 'label', 'all', { teamId }, false, errorMessage);\n throw new LinearAPIError(`Failed to fetch labels: ${errorMessage}`);\n }\n }\n \n // Workflow state operations\n async getWorkflowStates(teamId: string): Promise<WorkflowState[]> {\n try {\n const states = await this.client.workflowStates({\n filter: {\n team: { id: { eq: teamId } },\n },\n });\n \n const stateList = await states.nodes;\n \n this.logActivity('list_workflow_states', 'team', teamId, { \n count: stateList.length \n }, true);\n \n return stateList;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n this.logActivity('list_workflow_states', 'team', teamId, {}, false, errorMessage);\n throw new LinearAPIError(`Failed to fetch workflow states: ${errorMessage}`);\n }\n }\n} ","export interface LinearConfig {\n LINEAR_API_KEY: string;\n LINEAR_WORKSPACE_ID?: string;\n}\n\nexport interface LinearActivityItem {\n id: string;\n timestamp: string;\n action: string;\n resource_type: 'issue' | 'project' | 'comment' | 'label' | 'user' | 'team';\n resource_id: string;\n details: Record<string, any>;\n success: boolean;\n error?: string;\n}\n\nexport interface LinearIssueInput {\n title: string;\n description?: string;\n teamId: string;\n priority?: number; // 0 = No priority, 1 = Urgent, 2 = High, 3 = Normal, 4 = Low\n assigneeId?: string;\n labelIds?: string[];\n projectId?: string;\n stateId?: string;\n estimate?: number;\n dueDate?: Date;\n}\n\nexport interface LinearCommentInput {\n body: string;\n issueId: string;\n}\n\nexport interface LinearSearchFilters {\n state?: string[];\n assignee?: string[];\n label?: string[];\n project?: string;\n team?: string;\n priority?: number[];\n query?: string;\n limit?: number;\n}\n\n// Error classes specific to Linear\nexport class LinearAPIError extends Error {\n constructor(\n message: string,\n public status?: number,\n public response?: any\n ) {\n super(message);\n this.name = 'LinearAPIError';\n }\n}\n\nexport class LinearAuthenticationError extends LinearAPIError {\n constructor(message: string) {\n super(message, 401);\n this.name = 'LinearAuthenticationError';\n }\n}\n\nexport class LinearRateLimitError extends LinearAPIError {\n constructor(\n message: string,\n public resetTime: number\n ) {\n super(message, 429);\n this.name = 'LinearRateLimitError';\n }\n} ","import {\n Action,\n ActionResult,\n IAgentRuntime,\n Memory,\n State,\n ModelType,\n logger,\n HandlerCallback,\n} from '@elizaos/core';\nimport { LinearService } from '../services/linear';\nimport type { LinearIssueInput } from '../types';\n\nconst createIssueTemplate = `Given the user's request, extract the information needed to create a Linear issue.\n\nUser request: \"{{userMessage}}\"\n\nExtract and return ONLY a JSON object (no markdown formatting, no code blocks) with the following structure:\n{\n \"title\": \"Brief, clear issue title\",\n \"description\": \"Detailed description of the issue (optional, omit or use null if not provided)\",\n \"teamKey\": \"Team key if mentioned (e.g., ENG, PROD) - omit or use null if not mentioned\",\n \"priority\": \"Priority level if mentioned (1=urgent, 2=high, 3=normal, 4=low) - omit or use null if not mentioned\",\n \"labels\": [\"label1\", \"label2\"] (if any labels are mentioned, empty array if none),\n \"assignee\": \"Assignee username or email if mentioned - omit or use null if not mentioned\"\n}\n\nReturn only the JSON object, no other text.`;\n\nexport const createIssueAction: Action = {\n name: 'CREATE_LINEAR_ISSUE',\n description: 'Create a new issue in Linear',\n similes: ['create-linear-issue', 'new-linear-issue', 'add-linear-issue'],\n \n examples: [[\n {\n name: 'User',\n content: {\n text: 'Create a new issue: Fix login button not working on mobile devices'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll create that issue for you in Linear.',\n actions: ['CREATE_LINEAR_ISSUE']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Create a bug report for the ENG team: API returns 500 error when updating user profile'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll create a bug report for the engineering team right away.',\n actions: ['CREATE_LINEAR_ISSUE']\n }\n }\n ]],\n \n async validate(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> {\n try {\n const apiKey = runtime.getSetting('LINEAR_API_KEY');\n return !!apiKey;\n } catch {\n return false;\n }\n },\n \n async handler(\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> {\n try {\n const linearService = runtime.getService<LinearService>('linear');\n if (!linearService) {\n throw new Error('Linear service not available');\n }\n \n const content = message.content.text;\n if (!content) {\n const errorMessage = 'Please provide a description for the issue.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n // Check if the message already has structured data\n const structuredData = _options?.issueData as Partial<LinearIssueInput> | undefined;\n \n let issueData: Partial<LinearIssueInput>;\n \n if (structuredData) {\n issueData = structuredData;\n } else {\n // Use LLM to extract issue information\n const prompt = createIssueTemplate.replace('{{userMessage}}', content);\n \n const response = await runtime.useModel(ModelType.TEXT_LARGE, {\n prompt: prompt\n });\n \n if (!response) {\n throw new Error('Failed to extract issue information');\n }\n \n try {\n // Strip markdown code blocks if present\n const cleanedResponse = response.replace(/^```(?:json)?\\n?/,'').replace(/\\n?```$/,'').trim();\n const parsed = JSON.parse(cleanedResponse);\n \n // Clean up parsed data - convert empty strings to undefined for fields that need it\n issueData = {\n title: parsed.title || undefined,\n description: parsed.description || undefined,\n priority: parsed.priority ? Number(parsed.priority) : undefined,\n };\n \n // Handle team assignment\n if (parsed.teamKey) {\n const teams = await linearService.getTeams();\n const team = teams.find(t => \n t.key.toLowerCase() === parsed.teamKey.toLowerCase()\n );\n if (team) {\n issueData.teamId = team.id;\n }\n }\n \n // Handle assignee\n if (parsed.assignee && parsed.assignee !== '') {\n // Clean up assignee - remove @ symbol if present\n const cleanAssignee = parsed.assignee.replace(/^@/, '');\n \n const users = await linearService.getUsers();\n const user = users.find(u => \n u.email === cleanAssignee || \n u.name.toLowerCase().includes(cleanAssignee.toLowerCase())\n );\n if (user) {\n issueData.assigneeId = user.id;\n }\n }\n \n // Handle labels\n if (parsed.labels && Array.isArray(parsed.labels) && parsed.labels.length > 0) {\n const labels = await linearService.getLabels(issueData.teamId);\n const labelIds: string[] = [];\n \n for (const labelName of parsed.labels) {\n if (labelName && labelName !== '') {\n const label = labels.find(l => \n l.name.toLowerCase() === labelName.toLowerCase()\n );\n if (label) {\n labelIds.push(label.id);\n }\n }\n }\n \n if (labelIds.length > 0) {\n issueData.labelIds = labelIds;\n }\n }\n \n // If no team was specified, use the first available team as default\n if (!issueData.teamId) {\n // Check for default team key from environment\n const defaultTeamKey = runtime.getSetting('LINEAR_DEFAULT_TEAM_KEY') as string;\n \n if (defaultTeamKey) {\n const teams = await linearService.getTeams();\n const defaultTeam = teams.find(t => \n t.key.toLowerCase() === defaultTeamKey.toLowerCase()\n );\n if (defaultTeam) {\n issueData.teamId = defaultTeam.id;\n logger.info(`Using configured default team: ${defaultTeam.name} (${defaultTeam.key})`);\n } else {\n logger.warn(`Default team key ${defaultTeamKey} not found`);\n }\n }\n \n // If still no team, fall back to first available\n if (!issueData.teamId) {\n const teams = await linearService.getTeams();\n if (teams.length > 0) {\n issueData.teamId = teams[0].id;\n logger.warn(`No team specified, using first available team: ${teams[0].name}`);\n }\n }\n }\n } catch (parseError) {\n logger.error('Failed to parse LLM response:', parseError);\n // Fallback to simple title extraction\n issueData = {\n title: content.length > 100 ? content.substring(0, 100) + '...' : content,\n description: content\n };\n \n // Ensure we have a teamId even in fallback case\n const defaultTeamKey = runtime.getSetting('LINEAR_DEFAULT_TEAM_KEY') as string;\n const teams = await linearService.getTeams();\n \n if (defaultTeamKey) {\n const defaultTeam = teams.find(t => \n t.key.toLowerCase() === defaultTeamKey.toLowerCase()\n );\n if (defaultTeam) {\n issueData.teamId = defaultTeam.id;\n logger.info(`Using configured default team for fallback: ${defaultTeam.name} (${defaultTeam.key})`);\n }\n }\n \n if (!issueData.teamId && teams.length > 0) {\n issueData.teamId = teams[0].id;\n logger.warn(`Using first available team for fallback: ${teams[0].name}`);\n }\n }\n }\n \n if (!issueData.title) {\n const errorMessage = 'Could not determine issue title. Please provide more details.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n // Final check for required teamId\n if (!issueData.teamId) {\n const errorMessage = 'No Linear teams found. Please ensure at least one team exists in your Linear workspace.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n const issue = await linearService.createIssue(issueData as LinearIssueInput);\n \n // Send success message to channel\n const successMessage = `✅ Created Linear issue: ${issue.title} (${issue.identifier})\\n\\nView it at: ${issue.url}`;\n await callback?.({\n text: successMessage,\n source: message.content.source\n });\n \n return {\n text: `Created issue: ${issue.title} (${issue.identifier})`,\n success: true,\n data: {\n issueId: issue.id,\n identifier: issue.identifier,\n url: issue.url\n }\n };\n } catch (error) {\n logger.error('Failed to create issue:', error);\n const errorMessage = `❌ Failed to create issue: ${error instanceof Error ? error.message : 'Unknown error'}`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n }\n}; ","import { Action, ActionResult, IAgentRuntime, Memory, State, logger, HandlerCallback, ModelType } from '@elizaos/core';\nimport { LinearService } from '../services/linear';\n\nconst getIssueTemplate = `Extract issue identification from the user's request.\n\nUser request: \"{{userMessage}}\"\n\nThe user might reference an issue by:\n- Direct ID (e.g., \"ENG-123\", \"COM2-7\")\n- Title keywords (e.g., \"the login bug\", \"that payment issue\")\n- Assignee (e.g., \"John's high priority task\")\n- Recency (e.g., \"the latest bug\", \"most recent issue\")\n- Team context (e.g., \"newest issue in ELIZA team\")\n\nReturn ONLY a JSON object:\n{\n \"directId\": \"Issue ID if explicitly mentioned (e.g., ENG-123)\",\n \"searchBy\": {\n \"title\": \"Keywords from issue title if mentioned\",\n \"assignee\": \"Name/email of assignee if mentioned\", \n \"priority\": \"Priority level if mentioned (urgent/high/normal/low or 1-4)\",\n \"team\": \"Team name or key if mentioned\",\n \"state\": \"Issue state if mentioned (todo/in-progress/done)\",\n \"recency\": \"latest/newest/recent/last if mentioned\",\n \"type\": \"bug/feature/task if mentioned\"\n }\n}\n\nOnly include fields that are clearly mentioned or implied.`;\n\nexport const getIssueAction: Action = {\n name: 'GET_LINEAR_ISSUE',\n description: 'Get details of a specific Linear issue',\n similes: ['get-linear-issue', 'show-linear-issue', 'view-linear-issue', 'check-linear-issue', 'find-linear-issue'],\n \n examples: [[\n {\n name: 'User',\n content: {\n text: 'Show me issue ENG-123'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll get the details for issue ENG-123.',\n actions: ['GET_LINEAR_ISSUE']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'What\\'s the status of the login bug?'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'Let me find the login bug issue for you.',\n actions: ['GET_LINEAR_ISSUE']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Show me the latest high priority issue assigned to Sarah'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll find the latest high priority issue assigned to Sarah.',\n actions: ['GET_LINEAR_ISSUE']\n }\n }\n ]],\n \n async validate(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> {\n try {\n const apiKey = runtime.getSetting('LINEAR_API_KEY');\n return !!apiKey;\n } catch {\n return false;\n }\n },\n \n async handler(\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> {\n try {\n const linearService = runtime.getService<LinearService>('linear');\n if (!linearService) {\n throw new Error('Linear service not available');\n }\n \n const content = message.content.text;\n if (!content) {\n const errorMessage = 'Please specify which issue you want to see.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n // Use LLM to understand the request\n const prompt = getIssueTemplate.replace('{{userMessage}}', content);\n const response = await runtime.useModel(ModelType.TEXT_LARGE, {\n prompt: prompt\n });\n \n if (!response) {\n // Fallback to regex\n const issueMatch = content.match(/(\\w+-\\d+)/);\n if (issueMatch) {\n const issue = await linearService.getIssue(issueMatch[1]);\n return await formatIssueResponse(issue, callback, message);\n }\n throw new Error('Could not understand issue reference');\n }\n \n try {\n const parsed = JSON.parse(response.replace(/^```(?:json)?\\n?/,'').replace(/\\n?```$/,'').trim());\n \n // If direct ID is provided, use it\n if (parsed.directId) {\n const issue = await linearService.getIssue(parsed.directId);\n return await formatIssueResponse(issue, callback, message);\n }\n \n // Otherwise, search based on criteria\n if (parsed.searchBy && Object.keys(parsed.searchBy).length > 0) {\n const filters: any = {};\n \n // Build search filters\n if (parsed.searchBy.title) {\n filters.query = parsed.searchBy.title;\n }\n \n if (parsed.searchBy.assignee) {\n filters.assignee = [parsed.searchBy.assignee];\n }\n \n if (parsed.searchBy.priority) {\n const priorityMap: Record<string, number> = {\n 'urgent': 1, 'high': 2, 'normal': 3, 'low': 4,\n '1': 1, '2': 2, '3': 3, '4': 4\n };\n const priority = priorityMap[parsed.searchBy.priority.toLowerCase()];\n if (priority) {\n filters.priority = [priority];\n }\n }\n \n if (parsed.searchBy.team) {\n filters.team = parsed.searchBy.team;\n }\n \n if (parsed.searchBy.state) {\n filters.state = [parsed.searchBy.state];\n }\n \n // Apply default team if configured\n const defaultTeamKey = runtime.getSetting('LINEAR_DEFAULT_TEAM_KEY') as string;\n if (defaultTeamKey && !filters.team) {\n filters.team = defaultTeamKey;\n }\n \n // Search for issues\n const issues = await linearService.searchIssues({\n ...filters,\n limit: parsed.searchBy.recency ? 10 : 5\n });\n \n if (issues.length === 0) {\n const noResultsMessage = 'No issues found matching your criteria.';\n await callback?.({\n text: noResultsMessage,\n source: message.content.source\n });\n return {\n text: noResultsMessage,\n success: false\n };\n }\n \n // Sort by creation date if looking for recent\n if (parsed.searchBy.recency) {\n issues.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());\n }\n \n // If looking for recent/latest, return the first one\n if (parsed.searchBy.recency && issues.length > 0) {\n return await formatIssueResponse(issues[0], callback, message);\n }\n \n // If only one result, return it\n if (issues.length === 1) {\n return await formatIssueResponse(issues[0], callback, message);\n }\n \n // Multiple results - ask user to be more specific\n const issueList = await Promise.all(issues.slice(0, 5).map(async (issue, index) => {\n const state = await issue.state;\n return `${index + 1}. ${issue.identifier}: ${issue.title} (${state?.name || 'No state'})`;\n }));\n \n const clarifyMessage = `Found ${issues.length} issues matching your criteria:\\n${issueList.join('\\n')}\\n\\nPlease specify which one you want to see by its ID.`;\n await callback?.({\n text: clarifyMessage,\n source: message.content.source\n });\n \n return {\n text: clarifyMessage,\n success: true,\n data: {\n multipleResults: true,\n issues: issues.slice(0, 5).map(i => ({\n id: i.id,\n identifier: i.identifier,\n title: i.title\n }))\n }\n };\n }\n \n } catch (parseError) {\n logger.warn('Failed to parse LLM response, falling back to regex:', parseError);\n // Fallback to regex\n const issueMatch = content.match(/(\\w+-\\d+)/);\n if (issueMatch) {\n const issue = await linearService.getIssue(issueMatch[1]);\n return await formatIssueResponse(issue, callback, message);\n }\n }\n \n const errorMessage = 'Could not understand which issue you want to see. Please provide an issue ID (e.g., ENG-123) or describe it more specifically.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n \n } catch (error) {\n logger.error('Failed to get issue:', error);\n const errorMessage = `❌ Failed to get issue: ${error instanceof Error ? error.message : 'Unknown error'}`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n }\n};\n\n// Helper function to format issue response\nasync function formatIssueResponse(issue: any, callback: HandlerCallback | undefined, message: Memory): Promise<ActionResult> {\n const assignee = await issue.assignee;\n const state = await issue.state;\n const team = await issue.team;\n const labels = await issue.labels();\n const project = await issue.project;\n \n const issueDetails = {\n id: issue.id,\n identifier: issue.identifier,\n title: issue.title,\n description: issue.description,\n priority: issue.priority,\n priorityLabel: issue.priorityLabel,\n url: issue.url,\n createdAt: issue.createdAt,\n updatedAt: issue.updatedAt,\n dueDate: issue.dueDate,\n estimate: issue.estimate,\n assignee: assignee ? {\n id: assignee.id,\n name: assignee.name,\n email: assignee.email,\n } : null,\n state: state ? {\n id: state.id,\n name: state.name,\n type: state.type,\n color: state.color,\n } : null,\n team: team ? {\n id: team.id,\n name: team.name,\n key: team.key,\n } : null,\n labels: labels.nodes.map((label: any) => ({\n id: label.id,\n name: label.name,\n color: label.color,\n })),\n project: project ? {\n id: project.id,\n name: project.name,\n description: project.description,\n } : null,\n };\n \n const priorityLabels = ['', 'Urgent', 'High', 'Normal', 'Low'];\n const priority = priorityLabels[issue.priority || 0] || 'No priority';\n \n const labelText = issueDetails.labels.length > 0 \n ? `Labels: ${issueDetails.labels.map((l: any) => l.name).join(', ')}`\n : '';\n \n const issueMessage = `📋 **${issue.identifier}: ${issue.title}**\n \nStatus: ${state?.name || 'No status'}\nPriority: ${priority}\nTeam: ${team?.name || 'No team'}\nAssignee: ${assignee?.name || 'Unassigned'}\n${issue.dueDate ? `Due: ${new Date(issue.dueDate).toLocaleDateString()}` : ''}\n${labelText}\n${project ? `Project: ${project.name}` : ''}\n\n${issue.description || 'No description'}\n\nView in Linear: ${issue.url}`;\n \n await callback?.({\n text: issueMessage,\n source: message.content.source\n });\n \n return {\n text: `Retrieved issue ${issue.identifier}: ${issue.title}`,\n success: true,\n data: { issue: issueDetails }\n };\n} ","import { Action, ActionResult, IAgentRuntime, Memory, State, logger, HandlerCallback, ModelType } from '@elizaos/core';\nimport { LinearService } from '../services/linear';\nimport type { LinearIssueInput } from '../types';\n\nconst updateIssueTemplate = `Given the user's request to update a Linear issue, extract the information needed.\n\nUser request: \"{{userMessage}}\"\n\nExtract and return ONLY a JSON object (no markdown formatting, no code blocks) with the following structure:\n{\n \"issueId\": \"The issue identifier (e.g., ENG-123, COM2-7)\",\n \"updates\": {\n \"title\": \"New title if changing the title\",\n \"description\": \"New description if changing the description\",\n \"priority\": \"Priority level if changing (1=urgent, 2=high, 3=normal, 4=low)\",\n \"teamKey\": \"New team key if moving to another team (e.g., ENG, ELIZA, COM2)\",\n \"assignee\": \"New assignee username or email if changing\",\n \"status\": \"New status if changing (e.g., todo, in-progress, done, canceled)\",\n \"labels\": [\"label1\", \"label2\"] (if changing labels, empty array to clear)\n }\n}\n\nOnly include fields that are being updated. Return only the JSON object, no other text.`;\n\nexport const updateIssueAction: Action = {\n name: 'UPDATE_LINEAR_ISSUE',\n description: 'Update an existing Linear issue',\n similes: ['update-linear-issue', 'edit-linear-issue', 'modify-linear-issue', 'move-linear-issue', 'change-linear-issue'],\n \n examples: [[\n {\n name: 'User',\n content: {\n text: 'Update issue ENG-123 title to \"Fix login button on all devices\"'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll update the title of issue ENG-123 for you.',\n actions: ['UPDATE_LINEAR_ISSUE']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Move issue COM2-7 to the ELIZA team'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll move issue COM2-7 to the ELIZA team.',\n actions: ['UPDATE_LINEAR_ISSUE']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Change the priority of BUG-456 to high and assign to john@example.com'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll change the priority of BUG-456 to high and assign it to john@example.com.',\n actions: ['UPDATE_LINEAR_ISSUE']\n }\n }\n ]],\n \n async validate(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> {\n try {\n const apiKey = runtime.getSetting('LINEAR_API_KEY');\n return !!apiKey;\n } catch {\n return false;\n }\n },\n \n async handler(\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> {\n try {\n const linearService = runtime.getService<LinearService>('linear');\n if (!linearService) {\n throw new Error('Linear service not available');\n }\n \n const content = message.content.text;\n if (!content) {\n const errorMessage = 'Please provide update instructions for the issue.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n // Use LLM to extract update information\n const prompt = updateIssueTemplate.replace('{{userMessage}}', content);\n \n const response = await runtime.useModel(ModelType.TEXT_LARGE, {\n prompt: prompt\n });\n \n if (!response) {\n throw new Error('Failed to extract update information');\n }\n \n let issueId: string;\n let updates: Partial<LinearIssueInput> = {};\n \n try {\n // Strip markdown code blocks if present\n const cleanedResponse = response.replace(/^```(?:json)?\\n?/,'').replace(/\\n?```$/,'').trim();\n const parsed = JSON.parse(cleanedResponse);\n \n issueId = parsed.issueId;\n if (!issueId) {\n throw new Error('Issue ID not found in parsed response');\n }\n \n // Handle title update\n if (parsed.updates?.title) {\n updates.title = parsed.updates.title;\n }\n \n // Handle description update\n if (parsed.updates?.description) {\n updates.description = parsed.updates.description;\n }\n \n // Handle priority update\n if (parsed.updates?.priority) {\n updates.priority = Number(parsed.updates.priority);\n }\n \n // Handle team change\n if (parsed.updates?.teamKey) {\n const teams = await linearService.getTeams();\n const team = teams.find(t => \n t.key.toLowerCase() === parsed.updates.teamKey.toLowerCase()\n );\n if (team) {\n updates.teamId = team.id;\n logger.info(`Moving issue to team: ${team.name} (${team.key})`);\n } else {\n logger.warn(`Team with key ${parsed.updates.teamKey} not found`);\n }\n }\n \n // Handle assignee update\n if (parsed.updates?.assignee) {\n const cleanAssignee = parsed.updates.assignee.replace(/^@/, '');\n const users = await linearService.getUsers();\n const user = users.find(u => \n u.email === cleanAssignee || \n u.name.toLowerCase().includes(cleanAssignee.toLowerCase())\n );\n if (user) {\n updates.assigneeId = user.id;\n } else {\n logger.warn(`User ${cleanAssignee} not found`);\n }\n }\n \n // Handle status update\n if (parsed.updates?.status) {\n // Get the workflow states for the target team (or current team if not changing)\n const issue = await linearService.getIssue(issueId);\n const issueTeam = await issue.team;\n const teamId = updates.teamId || issueTeam?.id;\n if (!teamId) {\n logger.warn('Could not determine team for status update');\n } else {\n const states = await linearService.getWorkflowStates(teamId);\n \n const state = states.find(s => \n s.name.toLowerCase() === parsed.updates.status.toLowerCase() ||\n s.type.toLowerCase() === parsed.updates.status.toLowerCase()\n );\n \n if (state) {\n updates.stateId = state.id;\n logger.info(`Changing status to: ${state.name}`);\n } else {\n logger.warn(`Status ${parsed.updates.status} not found for team`);\n }\n }\n }\n \n // Handle labels update\n if (parsed.updates?.labels && Array.isArray(parsed.updates.labels)) {\n const teamId = updates.teamId;\n const labels = await linearService.getLabels(teamId);\n const labelIds: string[] = [];\n \n for (const labelName of parsed.updates.labels) {\n if (labelName) {\n const label = labels.find(l => \n l.name.toLowerCase() === labelName.toLowerCase()\n );\n if (label) {\n labelIds.push(label.id);\n }\n }\n }\n \n updates.labelIds = labelIds;\n }\n \n } catch (parseError) {\n // Fallback to regex parsing for simple cases\n logger.warn('Failed to parse LLM response, falling back to regex parsing:', parseError);\n \n const issueMatch = content.match(/(\\w+-\\d+)/);\n if (!issueMatch) {\n const errorMessage = 'Please specify an issue ID (e.g., ENG-123) to update.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n issueId = issueMatch[1];\n \n // Simple regex patterns for common updates\n const titleMatch = content.match(/title to [\"'](.+?)[\"']/i);\n if (titleMatch) {\n updates.title = titleMatch[1];\n }\n \n const priorityMatch = content.match(/priority (?:to |as )?(\\w+)/i);\n if (priorityMatch) {\n const priorityMap: Record<string, number> = {\n 'urgent': 1,\n 'high': 2,\n 'normal': 3,\n 'medium': 3,\n 'low': 4,\n };\n const priority = priorityMap[priorityMatch[1].toLowerCase()];\n if (priority) {\n updates.priority = priority;\n }\n }\n }\n \n if (Object.keys(updates).length === 0) {\n const errorMessage = 'No valid updates found. Please specify what to update (e.g., \"Update issue ENG-123 title to \\'New Title\\'\")';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n const updatedIssue = await linearService.updateIssue(issueId, updates);\n \n const updateSummary = [];\n if (updates.title) updateSummary.push(`title: \"${updates.title}\"`);\n if (updates.priority) updateSummary.push(`priority: ${['', 'urgent', 'high', 'normal', 'low'][updates.priority]}`);\n if (updates.teamId) updateSummary.push(`moved to team`);\n if (updates.assigneeId) updateSummary.push(`assigned to user`);\n if (updates.stateId) updateSummary.push(`status changed`);\n if (updates.labelIds) updateSummary.push(`labels updated`);\n \n const successMessage = `✅ Updated issue ${updatedIssue.identifier}: ${updateSummary.join(', ')}\\n\\nView it at: ${updatedIssue.url}`;\n await callback?.({\n text: successMessage,\n source: message.content.source\n });\n \n return {\n text: `Updated issue ${updatedIssue.identifier}: ${updateSummary.join(', ')}`,\n success: true,\n data: {\n issueId: updatedIssue.id,\n identifier: updatedIssue.identifier,\n updates,\n url: updatedIssue.url\n }\n };\n } catch (error) {\n logger.error('Failed to update issue:', error);\n const errorMessage = `❌ Failed to update issue: ${error instanceof Error ? error.message : 'Unknown error'}`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n }\n}; ","import { Action, ActionResult, IAgentRuntime, Memory, State, logger, HandlerCallback, ModelType } from '@elizaos/core';\nimport { LinearService } from '../services/linear';\n\nconst deleteIssueTemplate = `Given the user's request to delete/archive a Linear issue, extract the issue identifier.\n\nUser request: \"{{userMessage}}\"\n\nExtract and return ONLY a JSON object (no markdown formatting, no code blocks) with:\n{\n \"issueId\": \"The issue identifier (e.g., ENG-123, COM2-7)\"\n}\n\nReturn only the JSON object, no other text.`;\n\nexport const deleteIssueAction: Action = {\n name: 'DELETE_LINEAR_ISSUE',\n description: 'Delete (archive) an issue in Linear',\n similes: ['delete-linear-issue', 'archive-linear-issue', 'remove-linear-issue', 'close-linear-issue'],\n \n examples: [[\n {\n name: 'User',\n content: {\n text: 'Delete issue ENG-123'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll archive issue ENG-123 for you.',\n actions: ['DELETE_LINEAR_ISSUE']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Remove COM2-7 from Linear'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll archive issue COM2-7 in Linear.',\n actions: ['DELETE_LINEAR_ISSUE']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Archive the bug report BUG-456'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll archive issue BUG-456 for you.',\n actions: ['DELETE_LINEAR_ISSUE']\n }\n }\n ]],\n \n async validate(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> {\n try {\n const apiKey = runtime.getSetting('LINEAR_API_KEY');\n return !!apiKey;\n } catch {\n return false;\n }\n },\n \n async handler(\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> {\n try {\n const linearService = runtime.getService<LinearService>('linear');\n if (!linearService) {\n throw new Error('Linear service not available');\n }\n \n const content = message.content.text;\n if (!content) {\n const errorMessage = 'Please specify which issue to delete.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n let issueId: string;\n \n // Check if we have issueId in options\n if (_options?.issueId) {\n issueId = _options.issueId as string;\n } else {\n // Use LLM to extract issue ID\n const prompt = deleteIssueTemplate.replace('{{userMessage}}', content);\n \n const response = await runtime.useModel(ModelType.TEXT_LARGE, {\n prompt: prompt\n });\n \n if (!response) {\n throw new Error('Failed to extract issue identifier');\n }\n \n try {\n // Strip markdown code blocks if present\n const cleanedResponse = response.replace(/^```(?:json)?\\n?/,'').replace(/\\n?```$/,'').trim();\n const parsed = JSON.parse(cleanedResponse);\n \n issueId = parsed.issueId;\n if (!issueId) {\n throw new Error('Issue ID not found in parsed response');\n }\n } catch (parseError) {\n // Fallback to regex parsing\n logger.warn('Failed to parse LLM response, falling back to regex parsing:', parseError);\n \n const issueMatch = content.match(/(\\w+-\\d+)/);\n if (!issueMatch) {\n const errorMessage = 'Please specify an issue ID (e.g., ENG-123) to delete.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n issueId = issueMatch[1];\n }\n }\n \n // Get issue details before deletion to confirm and show title\n const issue = await linearService.getIssue(issueId);\n const issueTitle = issue.title;\n const issueIdentifier = issue.identifier;\n \n // Confirm deletion with user-friendly message\n logger.info(`Archiving issue ${issueIdentifier}: ${issueTitle}`);\n \n // Archive the issue (Linear doesn't support hard deletion)\n await linearService.deleteIssue(issueId);\n \n const successMessage = `✅ Successfully archived issue ${issueIdentifier}: \"${issueTitle}\"\\n\\nThe issue has been moved to the archived state and will no longer appear in active views.`;\n await callback?.({\n text: successMessage,\n source: message.content.source\n });\n \n return {\n text: `Archived issue ${issueIdentifier}: \"${issueTitle}\"`,\n success: true,\n data: {\n issueId: issue.id,\n identifier: issueIdentifier,\n title: issueTitle,\n archived: true\n }\n };\n } catch (error) {\n logger.error('Failed to delete issue:', error);\n const errorMessage = `❌ Failed to delete issue: ${error instanceof Error ? error.message : 'Unknown error'}`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n }\n}; ","import {\n Action,\n ActionResult,\n IAgentRuntime,\n Memory,\n State,\n ModelType,\n logger,\n HandlerCallback,\n} from '@elizaos/core';\nimport { LinearService } from '../services/linear';\nimport type { LinearSearchFilters } from '../types';\n\nconst searchTemplate = `Extract search criteria from the user's request for Linear issues.\n\nUser request: \"{{userMessage}}\"\n\nThe user might express searches in various ways:\n- \"Show me what John is working on\" → assignee filter\n- \"Any blockers for the next release?\" → priority/label filters\n- \"Issues created this week\" → date range filter\n- \"My high priority bugs\" → assignee (current user) + priority + label\n- \"Unassigned tasks in the backend team\" → no assignee + team filter\n- \"What did Sarah close yesterday?\" → assignee + state + date\n- \"Bugs that are almost done\" → label + state filter\n- \"Show me the oldest open issues\" → state + sort order\n\nExtract and return ONLY a JSON object:\n{\n \"query\": \"General search text for title/description\",\n \"states\": [\"state names like In Progress, Done, Todo, Backlog\"],\n \"assignees\": [\"assignee names or emails, or 'me' for current user\"],\n \"priorities\": [\"urgent/high/normal/low or 1/2/3/4\"],\n \"teams\": [\"team names or keys\"],\n \"labels\": [\"label names\"],\n \"hasAssignee\": true/false (true = has assignee, false = unassigned),\n \"dateRange\": {\n \"field\": \"created/updated/completed\",\n \"period\": \"today/yesterday/this-week/last-week/this-month/last-month\",\n \"from\": \"ISO date if specific date\",\n \"to\": \"ISO date if specific date\"\n },\n \"sort\": {\n \"field\": \"created/updated/priority\",\n \"order\": \"asc/desc\"\n },\n \"limit\": number (default 10)\n}\n\nOnly include fields that are clearly mentioned or implied. For \"my\" issues, set assignees to [\"me\"].`;\n\nexport const searchIssuesAction: Action = {\n name: 'SEARCH_LINEAR_ISSUES',\n description: 'Search for issues in Linear with various filters',\n similes: ['search-linear-issues', 'find-linear-issues', 'query-linear-issues', 'list-linear-issues'],\n \n examples: [[\n {\n name: 'User',\n content: {\n text: 'Show me all open bugs'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll search for all open bug issues in Linear.',\n actions: ['SEARCH_LINEAR_ISSUES']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'What is John working on?'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll find the issues assigned to John.',\n actions: ['SEARCH_LINEAR_ISSUES']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Show me high priority issues created this week'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll search for high priority issues created this week.',\n actions: ['SEARCH_LINEAR_ISSUES']\n }\n }\n ]],\n \n async validate(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> {\n try {\n const apiKey = runtime.getSetting('LINEAR_API_KEY');\n return !!apiKey;\n } catch {\n return false;\n }\n },\n \n async handler(\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> {\n try {\n const linearService = runtime.getService<LinearService>('linear');\n if (!linearService) {\n throw new Error('Linear service not available');\n }\n \n const content = message.content.text;\n if (!content) {\n const errorMessage = 'Please provide search criteria for issues.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n let filters: LinearSearchFilters = {};\n \n // Check if we have explicit filters in options\n if (_options?.filters) {\n filters = _options.filters as LinearSearchFilters;\n } else {\n // Use LLM to extract search filters\n const prompt = searchTemplate.replace('{{userMessage}}', content);\n \n const response = await runtime.useModel(ModelType.TEXT_LARGE, {\n prompt: prompt\n });\n \n if (!response) {\n // Fallback to simple keyword search\n filters = { query: content };\n } else {\n try {\n // Strip markdown code blocks if present\n const cleanedResponse = response.replace(/^```(?:json)?\\n?/,'').replace(/\\n?```$/,'').trim();\n const parsed = JSON.parse(cleanedResponse);\n \n // Build filters object\n filters = {\n query: parsed.query,\n limit: parsed.limit || 10\n };\n \n // Handle states\n if (parsed.states && parsed.states.length > 0) {\n filters.state = parsed.states;\n }\n \n // Handle assignees\n if (parsed.assignees && parsed.assignees.length > 0) {\n // Replace \"me\" with current user if we can get it\n const processedAssignees = [];\n for (const assignee of parsed.assignees) {\n if (assignee.toLowerCase() === 'me') {\n // Try to get current user\n try {\n const currentUser = await linearService.getCurrentUser();\n processedAssignees.push(currentUser.email);\n } catch {\n // If we can't get current user, skip \"me\"\n logger.warn('Could not resolve \"me\" to current user');\n }\n } else {\n processedAssignees.push(assignee);\n }\n }\n if (processedAssignees.length > 0) {\n filters.assignee = processedAssignees;\n }\n }\n \n // Handle unassigned filter\n if (parsed.hasAssignee === false) {\n // This would need special handling in the service layer\n // For now, we'll note it in the query\n filters.query = (filters.query ? filters.query + ' ' : '') + 'unassigned';\n }\n \n // Handle priorities\n if (parsed.priorities && parsed.priorities.length > 0) {\n const priorityMap: Record<string, number> = {\n 'urgent': 1, 'high': 2, 'normal': 3, 'low': 4,\n '1': 1, '2': 2, '3': 3, '4': 4\n };\n const priorities = parsed.priorities\n .map((p: string) => priorityMap[p.toLowerCase()])\n .filter(Boolean);\n if (priorities.length > 0) {\n filters.priority = priorities;\n }\n }\n \n // Handle teams\n if (parsed.teams && parsed.teams.length > 0) {\n // For now, take the first team since our interface supports single team\n filters.team = parsed.teams[0];\n }\n \n // Handle labels\n if (parsed.labels && parsed.labels.length > 0) {\n filters.label = parsed.labels;\n }\n \n // Note: Date range filtering and sorting would require API enhancements\n if (parsed.dateRange || parsed.sort) {\n logger.info('Date range and sort filters noted but not yet implemented');\n }\n \n // Clean up undefined values\n Object.keys(filters).forEach(key => {\n if (filters[key as keyof LinearSearchFilters] === undefined) {\n delete filters[key as keyof LinearSearchFilters];\n }\n });\n } catch (parseError) {\n logger.error('Failed to parse search filters:', parseError);\n // Fallback to simple search\n filters = { query: content };\n }\n }\n }\n \n // Apply default team filter if configured and no team filter was specified\n if (!filters.team) {\n const defaultTeamKey = runtime.getSetting('LINEAR_DEFAULT_TEAM_KEY') as string;\n if (defaultTeamKey) {\n // Check if the user explicitly asked for \"all\" issues\n const searchingAllIssues = content.toLowerCase().includes('all') && \n (content.toLowerCase().includes('issue') || \n content.toLowerCase().includes('bug') || \n content.toLowerCase().includes('task'));\n \n if (!searchingAllIssues) {\n filters.team = defaultTeamKey;\n logger.info(`Applying default team filter: ${defaultTeamKey}`);\n }\n }\n }\n \n filters.limit = (_options?.limit as number) || filters.limit || 10;\n \n const issues = await linearService.searchIssues(filters);\n \n if (issues.length === 0) {\n const noResultsMessage = 'No issues found matching your search criteria.';\n await callback?.({\n text: noResultsMessage,\n source: message.content.source\n });\n return {\n text: noResultsMessage,\n success: true,\n data: {\n issues: [],\n filters,\n count: 0\n }\n };\n }\n \n const issueList = await Promise.all(issues.map(async (issue, index) => {\n const state = await issue.state;\n const assignee = await issue.assignee;\n const priorityLabels = ['', 'Urgent', 'High', 'Normal', 'Low'];\n const priority = priorityLabels[issue.priority || 0] || 'No priority';\n \n return `${index + 1}. ${issue.identifier}: ${issue.title}\\n Status: ${state?.name || 'No state'} | Priority: ${priority} | Assignee: ${assignee?.name || 'Unassigned'}`;\n }));\n const issueText = issueList.join('\\n\\n');\n \n const resultMessage = `📋 Found ${issues.length} issue${issues.length === 1 ? '' : 's'}:\\n\\n${issueText}`;\n await callback?.({\n text: resultMessage,\n source: message.content.source\n });\n \n return {\n text: `Found ${issues.length} issue${issues.length === 1 ? '' : 's'}`,\n success: true,\n data: {\n issues: await Promise.all(issues.map(async issue => {\n const state = await issue.state;\n const assignee = await issue.assignee;\n const team = await issue.team;\n \n return {\n id: issue.id,\n identifier: issue.identifier,\n title: issue.title,\n url: issue.url,\n priority: issue.priority,\n state: state ? { name: state.name, type: state.type } : null,\n assignee: assignee ? { name: assignee.name, email: assignee.email } : null,\n team: team ? { name: team.name, key: team.key } : null,\n createdAt: issue.createdAt,\n updatedAt: issue.updatedAt\n };\n })),\n filters,\n count: issues.length\n }\n };\n } catch (error) {\n logger.error('Failed to search issues:', error);\n const errorMessage = `❌ Failed to search issues: ${error instanceof Error ? error.message : 'Unknown error'}`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n }\n}; ","import { Action, ActionResult, IAgentRuntime, Memory, State, logger, HandlerCallback, ModelType } from '@elizaos/core';\nimport { LinearService } from '../services/linear';\nimport type { LinearCommentInput } from '../types';\n\nconst createCommentTemplate = `Extract comment details from the user's request to add a comment to a Linear issue.\n\nUser request: \"{{userMessage}}\"\n\nThe user might express this in various ways:\n- \"Comment on ENG-123: This looks good\"\n- \"Tell ENG-123 that the fix is ready for testing\"\n- \"Add a note to the login bug saying we need more info\"\n- \"Reply to COM2-7: Thanks for the update\"\n- \"Let the payment issue know that it's blocked by API changes\"\n\nReturn ONLY a JSON object:\n{\n \"issueId\": \"Direct issue ID if explicitly mentioned (e.g., ENG-123)\",\n \"issueDescription\": \"Description/keywords of the issue if no ID provided\",\n \"commentBody\": \"The actual comment content to add\",\n \"commentType\": \"note/reply/update/question/feedback (inferred from context)\"\n}\n\nExtract the core message the user wants to convey as the comment body.`;\n\nexport const createCommentAction: Action = {\n name: 'CREATE_LINEAR_COMMENT',\n description: 'Add a comment to a Linear issue',\n similes: ['create-linear-comment', 'add-linear-comment', 'comment-on-linear-issue', 'reply-to-linear-issue'],\n \n examples: [[\n {\n name: 'User',\n content: {\n text: 'Comment on ENG-123: This looks good to me'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll add your comment to issue ENG-123.',\n actions: ['CREATE_LINEAR_COMMENT']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Tell the login bug that we need more information from QA'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll add that comment to the login bug issue.',\n actions: ['CREATE_LINEAR_COMMENT']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Reply to COM2-7: Thanks for the update, I\\'ll look into it'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll add your reply to issue COM2-7.',\n actions: ['CREATE_LINEAR_COMMENT']\n }\n }\n ]],\n \n async validate(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> {\n try {\n const apiKey = runtime.getSetting('LINEAR_API_KEY');\n return !!apiKey;\n } catch {\n return false;\n }\n },\n \n async handler(\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> {\n try {\n const linearService = runtime.getService<LinearService>('linear');\n if (!linearService) {\n throw new Error('Linear service not available');\n }\n \n const content = message.content.text;\n if (!content) {\n const errorMessage = 'Please provide a message with the issue and comment content.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n let issueId: string;\n let commentBody: string;\n \n // Check if we have explicit options\n if (_options?.issueId && _options?.body) {\n issueId = _options.issueId as string;\n commentBody = _options.body as string;\n } else {\n // Use LLM to extract comment information\n const prompt = createCommentTemplate.replace('{{userMessage}}', content);\n const response = await runtime.useModel(ModelType.TEXT_LARGE, {\n prompt: prompt\n });\n \n if (!response) {\n // Fallback to regex\n const issueMatch = content.match(/(?:comment on|add.*comment.*to|reply to|tell)\\s+(\\w+-\\d+):?\\s*(.*)/i);\n if (issueMatch) {\n issueId = issueMatch[1];\n commentBody = issueMatch[2].trim();\n } else {\n throw new Error('Could not understand comment request');\n }\n } else {\n try {\n const parsed = JSON.parse(response.replace(/^```(?:json)?\\n?/,'').replace(/\\n?```$/,'').trim());\n \n if (parsed.issueId) {\n issueId = parsed.issueId;\n commentBody = parsed.commentBody;\n } else if (parsed.issueDescription) {\n // Search for the issue by description\n const filters: any = {\n query: parsed.issueDescription,\n limit: 5\n };\n \n // Apply default team if configured\n const defaultTeamKey = runtime.getSetting('LINEAR_DEFAULT_TEAM_KEY') as string;\n if (defaultTeamKey) {\n filters.team = defaultTeamKey;\n }\n \n const issues = await linearService.searchIssues(filters);\n \n if (issues.length === 0) {\n const errorMessage = `No issues found matching \"${parsed.issueDescription}\". Please provide a specific issue ID.`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n if (issues.length === 1) {\n issueId = issues[0].identifier;\n commentBody = parsed.commentBody;\n } else {\n // Multiple matches - ask for clarification\n const issueList = await Promise.all(issues.map(async (issue, index) => {\n const state = await issue.state;\n return `${index + 1}. ${issue.identifier}: ${issue.title} (${state?.name || 'No state'})`;\n }));\n \n const clarifyMessage = `Found multiple issues matching \"${parsed.issueDescription}\":\\n${issueList.join('\\n')}\\n\\nPlease specify which issue to comment on by its ID.`;\n await callback?.({\n text: clarifyMessage,\n source: message.content.source\n });\n \n return {\n text: clarifyMessage,\n success: false,\n data: {\n multipleMatches: true,\n issues: issues.map(i => ({\n id: i.id,\n identifier: i.identifier,\n title: i.title\n })),\n pendingComment: parsed.commentBody\n }\n };\n }\n } else {\n throw new Error('No issue identifier or description found');\n }\n \n // Add comment type context if provided\n if (parsed.commentType && parsed.commentType !== 'note') {\n commentBody = `[${parsed.commentType.toUpperCase()}] ${commentBody}`;\n }\n \n } catch (parseError) {\n // Fallback to regex\n logger.warn('Failed to parse LLM response, falling back to regex:', parseError);\n const issueMatch = content.match(/(?:comment on|add.*comment.*to|reply to|tell)\\s+(\\w+-\\d+):?\\s*(.*)/i);\n \n if (!issueMatch) {\n const errorMessage = 'Please specify the issue ID and comment content. Example: \"Comment on ENG-123: This looks good\"';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n issueId = issueMatch[1];\n commentBody = issueMatch[2].trim();\n }\n }\n }\n \n if (!commentBody || commentBody.length === 0) {\n const errorMessage = 'Please provide the comment content.';\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n \n // Find the issue first to get its internal ID\n const issue = await linearService.getIssue(issueId);\n \n // Create the comment\n const comment = await linearService.createComment({\n issueId: issue.id,\n body: commentBody\n });\n \n const successMessage = `✅ Comment added to issue ${issue.identifier}: \"${commentBody}\"`;\n await callback?.({\n text: successMessage,\n source: message.content.source\n });\n \n return {\n text: `Added comment to issue ${issue.identifier}`,\n success: true,\n data: {\n commentId: comment.id,\n issueId: issue.id,\n issueIdentifier: issue.identifier,\n commentBody: commentBody,\n createdAt: comment.createdAt\n }\n };\n } catch (error) {\n logger.error('Failed to create comment:', error);\n const errorMessage = `❌ Failed to create comment: ${error instanceof Error ? error.message : 'Unknown error'}`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n }\n}; ","import { Action, ActionResult, IAgentRuntime, Memory, State, logger, HandlerCallback, ModelType } from '@elizaos/core';\nimport { LinearService } from '../services/linear';\n\nconst listTeamsTemplate = `Extract team filter criteria from the user's request.\n\nUser request: \"{{userMessage}}\"\n\nThe user might ask for teams in various ways:\n- \"Show me all teams\" → list all teams\n- \"Engineering teams\" → filter by teams with engineering in name/description\n- \"List teams I'm part of\" → filter by membership\n- \"Which teams work on the mobile app?\" → filter by description/focus\n- \"Show me the ELIZA team details\" → specific team lookup\n- \"Active teams\" → teams with recent activity\n- \"Frontend and backend teams\" → multiple team types\n\nReturn ONLY a JSON object:\n{\n \"nameFilter\": \"Keywords to search in team names\",\n \"specificTeam\": \"Specific team name or key if looking for one team\",\n \"myTeams\": true/false (true if user wants their teams),\n \"showAll\": true/false (true if user explicitly asks for \"all\"),\n \"includeDetails\": true/false (true if user wants detailed info)\n}\n\nOnly include fields that are clearly mentioned.`;\n\nexport const listTeamsAction: Action = {\n name: 'LIST_LINEAR_TEAMS',\n description: 'List teams in Linear with optional filters',\n similes: ['list-linear-teams', 'show-linear-teams', 'get-linear-teams', 'view-linear-teams'],\n \n examples: [[\n {\n name: 'User',\n content: {\n text: 'Show me all teams'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll list all the teams in Linear for you.',\n actions: ['LIST_LINEAR_TEAMS']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Which engineering teams do we have?'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'Let me find the engineering teams for you.',\n actions: ['LIST_LINEAR_TEAMS']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Show me the teams I\\'m part of'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll show you the teams you\\'re a member of.',\n actions: ['LIST_LINEAR_TEAMS']\n }\n }\n ]],\n \n async validate(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> {\n try {\n const apiKey = runtime.getSetting('LINEAR_API_KEY');\n return !!apiKey;\n } catch {\n return false;\n }\n },\n \n async handler(\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> {\n try {\n const linearService = runtime.getService<LinearService>('linear');\n if (!linearService) {\n throw new Error('Linear service not available');\n }\n \n const content = message.content.text || '';\n let nameFilter: string | undefined;\n let specificTeam: string | undefined;\n let myTeams = false;\n let includeDetails = false;\n \n // Use LLM to parse the request\n if (content) {\n const prompt = listTeamsTemplate.replace('{{userMessage}}', content);\n const response = await runtime.useModel(ModelType.TEXT_LARGE, {\n prompt: prompt\n });\n \n if (response) {\n try {\n const parsed = JSON.parse(response.replace(/^```(?:json)?\\n?/,'').replace(/\\n?```$/,'').trim());\n \n nameFilter = parsed.nameFilter;\n specificTeam = parsed.specificTeam;\n myTeams = parsed.myTeams === true;\n includeDetails = parsed.includeDetails === true;\n \n } catch (parseError) {\n logger.warn('Failed to parse team filters:', parseError);\n }\n }\n }\n \n let teams = await linearService.getTeams();\n \n // Filter for specific team\n if (specificTeam) {\n teams = teams.filter(team => \n team.key.toLowerCase() === specificTeam.toLowerCase() ||\n team.name.toLowerCase() === specificTeam.toLowerCase()\n );\n }\n \n // Filter by name keywords\n if (nameFilter && !specificTeam) {\n const keywords = nameFilter.toLowerCase().split(/\\s+/);\n teams = teams.filter(team => {\n const teamText = `${team.name} ${team.description || ''}`.toLowerCase();\n return keywords.some(keyword => teamText.includes(keyword));\n });\n }\n \n // Filter for user's teams if requested\n if (myTeams) {\n try {\n const currentUser = await linearService.getCurrentUser();\n // This would require fetching team membership - simplified for now\n logger.info('Team membership filtering not yet implemented');\n } catch {\n logger.warn('Could not get current user for team filtering');\n }\n }\n \n if (teams.length === 0) {\n const noTeamsMessage = specificTeam \n ? `No team found matching \"${specificTeam}\".`\n : nameFilter \n ? `No teams found matching \"${nameFilter}\".`\n : 'No teams found in Linear.';\n await callback?.({\n text: noTeamsMessage,\n source: message.content.source\n });\n return {\n text: noTeamsMessage,\n success: true,\n data: {\n teams: []\n }\n };\n }\n \n // Get additional details if requested or showing specific team\n let teamsWithDetails: any[] = teams;\n if (includeDetails || specificTeam) {\n teamsWithDetails = await Promise.all(teams.map(async (team) => {\n const membersQuery = await team.members();\n const members = await membersQuery.nodes;\n const projectsQuery = await team.projects();\n const projects = await projectsQuery.nodes;\n \n return {\n ...team,\n memberCount: members.length,\n projectCount: projects.length,\n membersList: specificTeam ? members.slice(0, 5) : [] // Include member details for specific team\n };\n }));\n }\n \n const teamList = teamsWithDetails.map((team: any, index) => {\n let info = `${index + 1}. ${team.name} (${team.key})`;\n \n if (team.description) {\n info += `\\n ${team.description}`;\n }\n \n if (includeDetails || specificTeam) {\n info += `\\n Members: ${team.memberCount} | Projects: ${team.projectCount}`;\n \n if (specificTeam && team.membersList.length > 0) {\n const memberNames = team.membersList.map((m: any) => m.name).join(', ');\n info += `\\n Team members: ${memberNames}${team.memberCount > 5 ? ' ...' : ''}`;\n }\n }\n \n return info;\n }).join('\\n\\n');\n \n const headerText = specificTeam && teams.length === 1\n ? `📋 Team Details:`\n : nameFilter \n ? `📋 Found ${teams.length} team${teams.length === 1 ? '' : 's'} matching \"${nameFilter}\":`\n : `📋 Found ${teams.length} team${teams.length === 1 ? '' : 's'}:`;\n \n const resultMessage = `${headerText}\\n\\n${teamList}`;\n await callback?.({\n text: resultMessage,\n source: message.content.source\n });\n \n return {\n text: `Found ${teams.length} team${teams.length === 1 ? '' : 's'}`,\n success: true,\n data: {\n teams: teamsWithDetails.map((t: any) => ({\n id: t.id,\n name: t.name,\n key: t.key,\n description: t.description,\n memberCount: t.memberCount,\n projectCount: t.projectCount\n })),\n count: teams.length,\n filters: {\n name: nameFilter,\n specific: specificTeam\n }\n }\n };\n } catch (error) {\n logger.error('Failed to list teams:', error);\n const errorMessage = `❌ Failed to list teams: ${error instanceof Error ? error.message : 'Unknown error'}`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n }\n}; ","import { Action, ActionResult, IAgentRuntime, Memory, State, logger, HandlerCallback, ModelType } from '@elizaos/core';\nimport { LinearService } from '../services/linear';\n\nconst listProjectsTemplate = `Extract project filter criteria from the user's request.\n\nUser request: \"{{userMessage}}\"\n\nThe user might ask for projects in various ways:\n- \"Show me all projects\" → list all projects\n- \"Active projects\" → filter by state (active/planned/completed)\n- \"Projects due this quarter\" → filter by target date\n- \"Which projects is Sarah managing?\" → filter by lead/owner\n- \"Projects with high priority issues\" → filter by contained issue priority\n- \"Projects for the engineering team\" → filter by team\n- \"Completed projects\" → filter by state\n- \"Projects starting next month\" → filter by start date\n\nReturn ONLY a JSON object:\n{\n \"teamFilter\": \"Team name or key if mentioned\",\n \"stateFilter\": \"active/planned/completed/all\",\n \"dateFilter\": {\n \"type\": \"due/starting\",\n \"period\": \"this-week/this-month/this-quarter/next-month/next-quarter\",\n \"from\": \"ISO date if specific\",\n \"to\": \"ISO date if specific\"\n },\n \"leadFilter\": \"Project lead name if mentioned\",\n \"showAll\": true/false (true if user explicitly asks for \"all\")\n}\n\nOnly include fields that are clearly mentioned.`;\n\nexport const listProjectsAction: Action = {\n name: 'LIST_LINEAR_PROJECTS',\n description: 'List projects in Linear with optional filters',\n similes: ['list-linear-projects', 'show-linear-projects', 'get-linear-projects', 'view-linear-projects'],\n \n examples: [[\n {\n name: 'User',\n content: {\n text: 'Show me all projects'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll list all the projects in Linear for you.',\n actions: ['LIST_LINEAR_PROJECTS']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'What active projects do we have?'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'Let me show you all the active projects.',\n actions: ['LIST_LINEAR_PROJECTS']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Show me projects for the engineering team'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll find the projects for the engineering team.',\n actions: ['LIST_LINEAR_PROJECTS']\n }\n }\n ]],\n \n async validate(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> {\n try {\n const apiKey = runtime.getSetting('LINEAR_API_KEY');\n return !!apiKey;\n } catch {\n return false;\n }\n },\n \n async handler(\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> {\n try {\n const linearService = runtime.getService<LinearService>('linear');\n if (!linearService) {\n throw new Error('Linear service not available');\n }\n \n const content = message.content.text || '';\n let teamId: string | undefined;\n let showAll = false;\n let stateFilter: string | undefined;\n \n // Use LLM to parse the request\n if (content) {\n const prompt = listProjectsTemplate.replace('{{userMessage}}', content);\n const response = await runtime.useModel(ModelType.TEXT_LARGE, {\n prompt: prompt\n });\n \n if (response) {\n try {\n const parsed = JSON.parse(response.replace(/^```(?:json)?\\n?/,'').replace(/\\n?```$/,'').trim());\n \n // Handle team filter\n if (parsed.teamFilter) {\n const teams = await linearService.getTeams();\n const team = teams.find(t => \n t.key.toLowerCase() === parsed.teamFilter.toLowerCase() ||\n t.name.toLowerCase() === parsed.teamFilter.toLowerCase()\n );\n if (team) {\n teamId = team.id;\n logger.info(`Filtering projects by team: ${team.name} (${team.key})`);\n }\n }\n \n // Handle show all flag\n showAll = parsed.showAll === true;\n \n // Handle state filter\n stateFilter = parsed.stateFilter;\n \n // Note: Date filters and lead filters would require API enhancements\n if (parsed.dateFilter || parsed.leadFilter) {\n logger.info('Date and lead filters noted but not yet implemented');\n }\n \n } catch (parseError) {\n logger.warn('Failed to parse project filters, using basic parsing:', parseError);\n \n // Fallback to basic parsing\n const teamMatch = content.match(/(?:for|in|of)\\s+(?:the\\s+)?(\\w+)\\s+team/i);\n if (teamMatch) {\n const teams = await linearService.getTeams();\n const team = teams.find(t => \n t.key.toLowerCase() === teamMatch[1].toLowerCase() ||\n t.name.toLowerCase() === teamMatch[1].toLowerCase()\n );\n if (team) {\n teamId = team.id;\n logger.info(`Filtering projects by team: ${team.name} (${team.key})`);\n }\n }\n \n showAll = content.toLowerCase().includes('all') && content.toLowerCase().includes('project');\n }\n }\n }\n \n // Apply default team filter if configured and user didn't ask for \"all\" projects\n if (!teamId && !showAll) {\n const defaultTeamKey = runtime.getSetting('LINEAR_DEFAULT_TEAM_KEY') as string;\n if (defaultTeamKey) {\n const teams = await linearService.getTeams();\n const defaultTeam = teams.find(t => \n t.key.toLowerCase() === defaultTeamKey.toLowerCase()\n );\n if (defaultTeam) {\n teamId = defaultTeam.id;\n logger.info(`Applying default team filter for projects: ${defaultTeam.name} (${defaultTeam.key})`);\n }\n }\n }\n \n let projects = await linearService.getProjects(teamId);\n \n // Client-side filtering by state if needed\n if (stateFilter && stateFilter !== 'all') {\n projects = projects.filter(project => {\n const state = project.state?.toLowerCase() || '';\n if (stateFilter === 'active') {\n return state === 'started' || state === 'in progress' || !state;\n } else if (stateFilter === 'planned') {\n return state === 'planned' || state === 'backlog';\n } else if (stateFilter === 'completed') {\n return state === 'completed' || state === 'done' || state === 'canceled';\n }\n return true;\n });\n }\n \n if (projects.length === 0) {\n const noProjectsMessage = teamId \n ? 'No projects found for the specified team.'\n : 'No projects found in Linear.';\n await callback?.({\n text: noProjectsMessage,\n source: message.content.source\n });\n return {\n text: noProjectsMessage,\n success: true,\n data: {\n projects: []\n }\n };\n }\n \n // Get teams for each project\n const projectsWithDetails = await Promise.all(\n projects.map(async (project) => {\n const teamsQuery = await project.teams();\n const teams = await teamsQuery.nodes;\n const lead = await project.lead;\n \n return {\n ...project,\n teamsList: teams,\n leadUser: lead\n };\n })\n );\n \n const projectList = projectsWithDetails.map((project, index) => {\n const teamNames = project.teamsList.map((t: any) => t.name).join(', ') || 'No teams';\n const status = project.state || 'Active';\n const progress = project.progress ? ` (${Math.round(project.progress * 100)}% complete)` : '';\n const lead = project.leadUser ? ` | Lead: ${project.leadUser.name}` : '';\n const dates = [];\n if (project.startDate) dates.push(`Start: ${new Date(project.startDate).toLocaleDateString()}`);\n if (project.targetDate) dates.push(`Due: ${new Date(project.targetDate).toLocaleDateString()}`);\n const dateInfo = dates.length > 0 ? `\\n ${dates.join(' | ')}` : '';\n \n return `${index + 1}. ${project.name}${project.description ? ` - ${project.description}` : ''}\\n Status: ${status}${progress} | Teams: ${teamNames}${lead}${dateInfo}`;\n }).join('\\n\\n');\n \n const headerText = stateFilter && stateFilter !== 'all'\n ? `📁 Found ${projects.length} ${stateFilter} project${projects.length === 1 ? '' : 's'}:`\n : `📁 Found ${projects.length} project${projects.length === 1 ? '' : 's'}:`;\n \n const resultMessage = `${headerText}\\n\\n${projectList}`;\n await callback?.({\n text: resultMessage,\n source: message.content.source\n });\n \n return {\n text: `Found ${projects.length} project${projects.length === 1 ? '' : 's'}`,\n success: true,\n data: {\n projects: projectsWithDetails.map(p => ({\n id: p.id,\n name: p.name,\n description: p.description,\n url: p.url,\n teams: p.teamsList.map((t: any) => ({\n id: t.id,\n name: t.name,\n key: t.key\n })),\n lead: p.leadUser ? {\n id: p.leadUser.id,\n name: p.leadUser.name,\n email: p.leadUser.email\n } : null,\n state: p.state,\n progress: p.progress,\n startDate: p.startDate,\n targetDate: p.targetDate\n })),\n count: projects.length,\n filters: {\n team: teamId,\n state: stateFilter\n }\n }\n };\n } catch (error) {\n logger.error('Failed to list projects:', error);\n const errorMessage = `❌ Failed to list projects: ${error instanceof Error ? error.message : 'Unknown error'}`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n }\n}; ","import { Action, ActionResult, IAgentRuntime, Memory, State, logger, HandlerCallback, ModelType } from '@elizaos/core';\nimport { LinearService } from '../services/linear';\n\nconst getActivityTemplate = `Extract activity filter criteria from the user's request.\n\nUser request: \"{{userMessage}}\"\n\nThe user might ask for activity in various ways:\n- \"Show me today's activity\" → time range filter\n- \"What issues were created?\" → action type filter\n- \"What did John do yesterday?\" → user filter + time range\n- \"Activity on ENG-123\" → resource filter\n- \"Recent comment activity\" → action type + recency\n- \"Failed operations this week\" → success filter + time range\n\nReturn ONLY a JSON object:\n{\n \"timeRange\": {\n \"period\": \"today/yesterday/this-week/last-week/this-month\",\n \"from\": \"ISO datetime if specific\",\n \"to\": \"ISO datetime if specific\"\n },\n \"actionTypes\": [\"create_issue/update_issue/delete_issue/create_comment/search_issues/etc\"],\n \"resourceTypes\": [\"issue/project/comment/team\"],\n \"resourceId\": \"Specific resource ID if mentioned (e.g., ENG-123)\",\n \"user\": \"User name or 'me' for current user\",\n \"successFilter\": \"success/failed/all\",\n \"limit\": number (default 10)\n}\n\nOnly include fields that are clearly mentioned.`;\n\nexport const getActivityAction: Action = {\n name: 'GET_LINEAR_ACTIVITY',\n description: 'Get recent Linear activity log with optional filters',\n similes: ['get-linear-activity', 'show-linear-activity', 'view-linear-activity', 'check-linear-activity'],\n \n examples: [[\n {\n name: 'User',\n content: {\n text: 'Show me recent Linear activity'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll show you the recent Linear activity.',\n actions: ['GET_LINEAR_ACTIVITY']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'What happened in Linear today?'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'Let me check today\\'s Linear activity for you.',\n actions: ['GET_LINEAR_ACTIVITY']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Show me what issues John created this week'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll find the issues John created this week.',\n actions: ['GET_LINEAR_ACTIVITY']\n }\n }\n ]],\n \n async validate(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> {\n try {\n const apiKey = runtime.getSetting('LINEAR_API_KEY');\n return !!apiKey;\n } catch {\n return false;\n }\n },\n \n async handler(\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> {\n try {\n const linearService = runtime.getService<LinearService>('linear');\n if (!linearService) {\n throw new Error('Linear service not available');\n }\n \n const content = message.content.text || '';\n let filters: any = {};\n let limit = 10;\n \n // Use LLM to parse filters if content is provided\n if (content) {\n const prompt = getActivityTemplate.replace('{{userMessage}}', content);\n const response = await runtime.useModel(ModelType.TEXT_LARGE, {\n prompt: prompt\n });\n \n if (response) {\n try {\n const parsed = JSON.parse(response.replace(/^```(?:json)?\\n?/,'').replace(/\\n?```$/,'').trim());\n \n // Handle time range filtering\n if (parsed.timeRange) {\n const now = new Date();\n let fromDate: Date | undefined;\n \n if (parsed.timeRange.from) {\n fromDate = new Date(parsed.timeRange.from);\n } else if (parsed.timeRange.period) {\n switch (parsed.timeRange.period) {\n case 'today':\n fromDate = new Date(now.setHours(0, 0, 0, 0));\n break;\n case 'yesterday':\n fromDate = new Date(now.setDate(now.getDate() - 1));\n fromDate.setHours(0, 0, 0, 0);\n break;\n case 'this-week':\n fromDate = new Date(now.setDate(now.getDate() - now.getDay()));\n fromDate.setHours(0, 0, 0, 0);\n break;\n case 'last-week':\n fromDate = new Date(now.setDate(now.getDate() - now.getDay() - 7));\n fromDate.setHours(0, 0, 0, 0);\n break;\n case 'this-month':\n fromDate = new Date(now.getFullYear(), now.getMonth(), 1);\n break;\n }\n }\n \n if (fromDate) {\n filters.fromDate = fromDate.toISOString();\n }\n }\n \n // Handle action type filter\n if (parsed.actionTypes && parsed.actionTypes.length > 0) {\n filters.action = parsed.actionTypes[0]; // Service currently supports single action\n }\n \n // Handle resource type filter\n if (parsed.resourceTypes && parsed.resourceTypes.length > 0) {\n filters.resource_type = parsed.resourceTypes[0];\n }\n \n // Handle resource ID filter\n if (parsed.resourceId) {\n filters.resource_id = parsed.resourceId;\n }\n \n // Handle success filter\n if (parsed.successFilter && parsed.successFilter !== 'all') {\n filters.success = parsed.successFilter === 'success';\n }\n \n // Set limit\n limit = parsed.limit || 10;\n \n } catch (parseError) {\n logger.warn('Failed to parse activity filters:', parseError);\n }\n }\n }\n \n // Get filtered activity\n let activity = linearService.getActivityLog(limit * 2, filters); // Get more to filter client-side\n \n // Additional client-side filtering for time range\n if (filters.fromDate) {\n const fromTime = new Date(filters.fromDate).getTime();\n activity = activity.filter(item => new Date(item.timestamp).getTime() >= fromTime);\n }\n \n // Limit results\n activity = activity.slice(0, limit);\n \n if (activity.length === 0) {\n const noActivityMessage = filters.fromDate \n ? `No Linear activity found for the specified filters.`\n : 'No recent Linear activity found.';\n await callback?.({\n text: noActivityMessage,\n source: message.content.source\n });\n return {\n text: noActivityMessage,\n success: true,\n data: {\n activity: []\n }\n };\n }\n \n const activityText = activity\n .map((item, index) => {\n const time = new Date(item.timestamp).toLocaleString();\n const status = item.success ? '✅' : '❌';\n const details = Object.entries(item.details)\n .filter(([key]) => key !== 'filters') // Don't show filter details\n .map(([key, value]) => `${key}: ${JSON.stringify(value)}`)\n .join(', ');\n \n return `${index + 1}. ${status} ${item.action} on ${item.resource_type} ${item.resource_id}\\n Time: ${time}\\n ${details ? `Details: ${details}` : ''}${item.error ? `\\n Error: ${item.error}` : ''}`;\n })\n .join('\\n\\n');\n \n const headerText = filters.fromDate \n ? `📊 Linear activity ${content}:`\n : '📊 Recent Linear activity:';\n \n const resultMessage = `${headerText}\\n\\n${activityText}`;\n await callback?.({\n text: resultMessage,\n source: message.content.source\n });\n \n return {\n text: `Found ${activity.length} activity item${activity.length === 1 ? '' : 's'}`,\n success: true,\n data: {\n activity,\n filters,\n count: activity.length\n }\n };\n } catch (error) {\n logger.error('Failed to get activity:', error);\n const errorMessage = `❌ Failed to get activity: ${error instanceof Error ? error.message : 'Unknown error'}`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n }\n}; ","import { Action, ActionResult, IAgentRuntime, Memory, State, ActionExample, logger, HandlerCallback } from '@elizaos/core';\nimport { LinearService } from '../services/linear';\n\nexport const clearActivityAction: Action = {\n name: 'CLEAR_LINEAR_ACTIVITY',\n description: 'Clear the Linear activity log',\n similes: ['clear-linear-activity', 'reset-linear-activity', 'delete-linear-activity'],\n \n examples: [[\n {\n name: 'User',\n content: {\n text: 'Clear the Linear activity log'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll clear the Linear activity log for you.',\n actions: ['CLEAR_LINEAR_ACTIVITY']\n }\n }\n ], [\n {\n name: 'User',\n content: {\n text: 'Reset Linear activity'\n }\n },\n {\n name: 'Assistant',\n content: {\n text: 'I\\'ll reset the Linear activity log now.',\n actions: ['CLEAR_LINEAR_ACTIVITY']\n }\n }\n ]],\n \n async validate(runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> {\n try {\n const apiKey = runtime.getSetting('LINEAR_API_KEY');\n return !!apiKey;\n } catch {\n return false;\n }\n },\n \n async handler(\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> {\n try {\n const linearService = runtime.getService<LinearService>('linear');\n if (!linearService) {\n throw new Error('Linear service not available');\n }\n \n await linearService.clearActivityLog();\n \n const successMessage = '✅ Linear activity log has been cleared.';\n await callback?.({\n text: successMessage,\n source: message.content.source\n });\n \n return {\n text: successMessage,\n success: true\n };\n } catch (error) {\n logger.error('Failed to clear Linear activity:', error);\n const errorMessage = `❌ Failed to clear Linear activity: ${error instanceof Error ? error.message : 'Unknown error'}`;\n await callback?.({\n text: errorMessage,\n source: message.content.source\n });\n return {\n text: errorMessage,\n success: false\n };\n }\n }\n}; ","import { Plugin } from '@elizaos/core';\nimport { LinearService } from './services/linear';\n\n// Import all actions\nimport { createIssueAction } from './actions/createIssue';\nimport { getIssueAction } from './actions/getIssue';\nimport { updateIssueAction } from './actions/updateIssue';\nimport { deleteIssueAction } from './actions/deleteIssue';\nimport { searchIssuesAction } from './actions/searchIssues';\nimport { createCommentAction } from './actions/createComment';\nimport { listTeamsAction } from './actions/listTeams';\nimport { listProjectsAction } from './actions/listProjects';\nimport { getActivityAction } from './actions/getActivity';\nimport { clearActivityAction } from './actions/clearActivity';\n\n// Import all providers\n// import { linearIssuesProvider } from './providers/issues';\n// import { linearTeamsProvider } from './providers/teams';\n// import { linearProjectsProvider } from './providers/projects';\n// import { linearActivityProvider } from './providers/activity';\n\nexport const linearPlugin: Plugin = {\n name: '@elizaos/plugin-linear',\n description: 'Plugin for integrating with Linear issue tracking system',\n services: [LinearService],\n actions: [\n createIssueAction,\n getIssueAction,\n updateIssueAction,\n deleteIssueAction,\n searchIssuesAction,\n createCommentAction,\n listTeamsAction,\n listProjectsAction,\n getActivityAction,\n clearActivityAction,\n ],\n providers: [\n // linearIssuesProvider,\n // linearTeamsProvider,\n // linearProjectsProvider,\n // linearActivityProvider,\n ],\n};\n\n// Re-export types and service for external use\nexport * from './types';\nexport { LinearService } from './services/linear'; "],"mappings":";AAAA,SAAS,QAAQ,eAAmC;AACpD,SAAS,oBAAoF;;;AC6CtF,IAAM,iBAAN,cAA6B,MAAM;AAAA,EACxC,YACE,SACO,QACA,UACP;AACA,UAAM,OAAO;AAHN;AACA;AAGP,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,4BAAN,cAAwC,eAAe;AAAA,EAC5D,YAAY,SAAiB;AAC3B,UAAM,SAAS,GAAG;AAClB,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,uBAAN,cAAmC,eAAe;AAAA,EACvD,YACE,SACO,WACP;AACA,UAAM,SAAS,GAAG;AAFX;AAGP,SAAK,OAAO;AAAA,EACd;AACF;;;AD7DO,IAAM,iBAAN,MAAM,uBAAsB,QAAQ;AAAA,EAUzC,YAAY,SAAyB;AACnC,UAAM,OAAO;AARf,iCAAwB;AAGxB,SAAQ,cAAoC,CAAC;AAQ3C,UAAM,SAAS,SAAS,WAAW,gBAAgB;AACnD,UAAM,cAAc,SAAS,WAAW,qBAAqB;AAE7D,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,0BAA0B,4BAA4B;AAAA,IAClE;AAEA,SAAK,eAAe;AAAA,MAClB,gBAAgB;AAAA,MAChB,qBAAqB;AAAA,IACvB;AAEA,SAAK,cAAc;AAEnB,SAAK,SAAS;AAAA,MACZ,gBA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AAAA,MAChD;AAEA,YAAM,cAAc,iBAAiB;AAErC,YAAM,iBAAiB;AACvB,YAAM,WAAW;AAAA,QACf,MAAM;AAAA,QACN,QAAQ,QAAQ,QAAQ;AAAA,MAC1B,CAAC;AAED,aAAO;AAAA,QACL,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,IACF,SAAS,OAAO;AACd,MAAAA,SAAO,MAAM,oCAAoC,KAAK;AACtD,YAAM,eAAe,2CAAsC,iBAAiB,QAAQ,MAAM,UAAU,eAAe;AACnH,YAAM,WAAW;AAAA,QACf,MAAM;AAAA,QACN,QAAQ,QAAQ,QAAQ;AAAA,MAC1B,CAAC;AACD,aAAO;AAAA,QACL,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AACF;;;AChEO,IAAM,eAAuB;AAAA,EAClC,MAAM;AAAA,EACN,aAAa;AAAA,EACb,UAAU,CAAC,aAAa;AAAA,EACxB,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA,EAKX;AACF;","names":["logger","logger","ModelType","errorMessage","logger","ModelType","logger","ModelType","ModelType","logger","logger","ModelType","issue","logger","ModelType","logger","ModelType","logger","ModelType","logger"]}
|