@supaku/agentfactory-linear 0.1.0
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/LICENSE +21 -0
- package/dist/src/agent-client.d.ts +195 -0
- package/dist/src/agent-client.d.ts.map +1 -0
- package/dist/src/agent-client.js +548 -0
- package/dist/src/agent-session.d.ts +284 -0
- package/dist/src/agent-session.d.ts.map +1 -0
- package/dist/src/agent-session.js +875 -0
- package/dist/src/checkbox-utils.d.ts +88 -0
- package/dist/src/checkbox-utils.d.ts.map +1 -0
- package/dist/src/checkbox-utils.js +120 -0
- package/dist/src/constants.d.ts +77 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +87 -0
- package/dist/src/errors.d.ts +79 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +155 -0
- package/dist/src/index.d.ts +15 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +16 -0
- package/dist/src/retry.d.ts +43 -0
- package/dist/src/retry.d.ts.map +1 -0
- package/dist/src/retry.js +73 -0
- package/dist/src/types.d.ts +412 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +121 -0
- package/dist/src/utils.d.ts +52 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +277 -0
- package/package.json +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Supaku
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { LinearClient } from '@linear/sdk';
|
|
2
|
+
import type { Issue, Comment } from '@linear/sdk';
|
|
3
|
+
import type { LinearAgentClientConfig, LinearWorkflowStatus, StatusMapping, AgentActivityCreateInput, AgentActivityResult, AgentSessionUpdateInput, AgentSessionUpdateResult, AgentSessionCreateOnIssueInput, AgentSessionCreateResult, IssueRelationCreateInput, IssueRelationResult, IssueRelationBatchResult, IssueRelationsResult, IssueRelationType, SubIssueGraph, SubIssueStatus } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Core Linear Agent Client
|
|
6
|
+
* Wraps @linear/sdk with retry logic and helper methods
|
|
7
|
+
*/
|
|
8
|
+
export declare class LinearAgentClient {
|
|
9
|
+
private readonly client;
|
|
10
|
+
private readonly retryConfig;
|
|
11
|
+
private statusCache;
|
|
12
|
+
constructor(config: LinearAgentClientConfig);
|
|
13
|
+
/**
|
|
14
|
+
* Get the underlying LinearClient instance
|
|
15
|
+
*/
|
|
16
|
+
get linearClient(): LinearClient;
|
|
17
|
+
/**
|
|
18
|
+
* Execute an operation with retry logic
|
|
19
|
+
*/
|
|
20
|
+
private withRetry;
|
|
21
|
+
/**
|
|
22
|
+
* Fetch an issue by ID or identifier (e.g., "SUP-50")
|
|
23
|
+
*/
|
|
24
|
+
getIssue(issueIdOrIdentifier: string): Promise<Issue>;
|
|
25
|
+
/**
|
|
26
|
+
* Update an issue's properties
|
|
27
|
+
*/
|
|
28
|
+
updateIssue(issueId: string, data: {
|
|
29
|
+
title?: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
stateId?: string;
|
|
32
|
+
assigneeId?: string | null;
|
|
33
|
+
priority?: number;
|
|
34
|
+
labelIds?: string[];
|
|
35
|
+
}): Promise<Issue>;
|
|
36
|
+
/**
|
|
37
|
+
* Remove the assignee from an issue (unassign)
|
|
38
|
+
* Used when agent completes work to enable clean handoff visibility
|
|
39
|
+
*/
|
|
40
|
+
unassignIssue(issueId: string): Promise<Issue>;
|
|
41
|
+
/**
|
|
42
|
+
* Get workflow states for a team (cached)
|
|
43
|
+
*/
|
|
44
|
+
getTeamStatuses(teamId: string): Promise<StatusMapping>;
|
|
45
|
+
/**
|
|
46
|
+
* Update issue status by name (e.g., "Started", "Finished")
|
|
47
|
+
*/
|
|
48
|
+
updateIssueStatus(issueId: string, statusName: LinearWorkflowStatus): Promise<Issue>;
|
|
49
|
+
/**
|
|
50
|
+
* Create a comment on an issue
|
|
51
|
+
*/
|
|
52
|
+
createComment(issueId: string, body: string): Promise<Comment>;
|
|
53
|
+
/**
|
|
54
|
+
* Get comments for an issue
|
|
55
|
+
*/
|
|
56
|
+
getIssueComments(issueId: string): Promise<Comment[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Create a new issue
|
|
59
|
+
*/
|
|
60
|
+
createIssue(input: {
|
|
61
|
+
title: string;
|
|
62
|
+
description?: string;
|
|
63
|
+
teamId: string;
|
|
64
|
+
projectId?: string;
|
|
65
|
+
stateId?: string;
|
|
66
|
+
labelIds?: string[];
|
|
67
|
+
parentId?: string;
|
|
68
|
+
priority?: number;
|
|
69
|
+
}): Promise<Issue>;
|
|
70
|
+
/**
|
|
71
|
+
* Get the authenticated user (the agent)
|
|
72
|
+
*/
|
|
73
|
+
getViewer(): Promise<import("@linear/sdk").User>;
|
|
74
|
+
/**
|
|
75
|
+
* Get a team by ID or key
|
|
76
|
+
*/
|
|
77
|
+
getTeam(teamIdOrKey: string): Promise<import("@linear/sdk").Team>;
|
|
78
|
+
/**
|
|
79
|
+
* Create an agent activity using the native Linear Agent API
|
|
80
|
+
*
|
|
81
|
+
* @param input - The activity input containing session ID, content, and options
|
|
82
|
+
* @returns Result indicating success and the created activity ID
|
|
83
|
+
*/
|
|
84
|
+
createAgentActivity(input: AgentActivityCreateInput): Promise<AgentActivityResult>;
|
|
85
|
+
/**
|
|
86
|
+
* Update an agent session
|
|
87
|
+
*
|
|
88
|
+
* Use this to set the externalUrl (linking to agent dashboard/logs)
|
|
89
|
+
* within 10 seconds of receiving a webhook to avoid appearing unresponsive.
|
|
90
|
+
*
|
|
91
|
+
* @param input - The session update input containing sessionId and updates
|
|
92
|
+
* @returns Result indicating success and the session ID
|
|
93
|
+
*/
|
|
94
|
+
updateAgentSession(input: AgentSessionUpdateInput): Promise<AgentSessionUpdateResult>;
|
|
95
|
+
/**
|
|
96
|
+
* Create an agent session on an issue
|
|
97
|
+
*
|
|
98
|
+
* Use this to programmatically create a Linear AgentSession when status transitions
|
|
99
|
+
* occur without explicit agent mention/delegation (e.g., Icebox -> Backlog).
|
|
100
|
+
*
|
|
101
|
+
* This enables the Linear Agent Session UI to show real-time activities even when
|
|
102
|
+
* the agent work is triggered by status changes rather than user mentions.
|
|
103
|
+
*
|
|
104
|
+
* @param input - The session creation input containing issueId and optional external URLs
|
|
105
|
+
* @returns Result indicating success and the created session ID
|
|
106
|
+
*/
|
|
107
|
+
createAgentSessionOnIssue(input: AgentSessionCreateOnIssueInput): Promise<AgentSessionCreateResult>;
|
|
108
|
+
/**
|
|
109
|
+
* Create a relation between two issues
|
|
110
|
+
*
|
|
111
|
+
* @param input - The relation input containing issue IDs and relation type
|
|
112
|
+
* @returns Result indicating success and the created relation ID
|
|
113
|
+
*
|
|
114
|
+
* Relation types:
|
|
115
|
+
* - 'related': General association between issues
|
|
116
|
+
* - 'blocks': Source issue blocks the related issue from progressing
|
|
117
|
+
* - 'duplicate': Source issue is a duplicate of the related issue
|
|
118
|
+
*/
|
|
119
|
+
createIssueRelation(input: IssueRelationCreateInput): Promise<IssueRelationResult>;
|
|
120
|
+
/**
|
|
121
|
+
* Create multiple relations from a source issue to multiple target issues
|
|
122
|
+
*
|
|
123
|
+
* @param input - Batch input containing source issue, target issues, and relation type
|
|
124
|
+
* @returns Batch result with successful relation IDs and any errors
|
|
125
|
+
*/
|
|
126
|
+
createIssueRelationsBatch(input: {
|
|
127
|
+
sourceIssueId: string;
|
|
128
|
+
targetIssueIds: string[];
|
|
129
|
+
type: IssueRelationType;
|
|
130
|
+
}): Promise<IssueRelationBatchResult>;
|
|
131
|
+
/**
|
|
132
|
+
* Get all relations for an issue (both outgoing and incoming)
|
|
133
|
+
*
|
|
134
|
+
* @param issueId - The issue ID or identifier (e.g., "SUP-123")
|
|
135
|
+
* @returns Relations result with both directions of relationships
|
|
136
|
+
*/
|
|
137
|
+
getIssueRelations(issueId: string): Promise<IssueRelationsResult>;
|
|
138
|
+
/**
|
|
139
|
+
* Delete an issue relation
|
|
140
|
+
*
|
|
141
|
+
* @param relationId - The relation ID to delete
|
|
142
|
+
* @returns Result indicating success
|
|
143
|
+
*/
|
|
144
|
+
deleteIssueRelation(relationId: string): Promise<{
|
|
145
|
+
success: boolean;
|
|
146
|
+
}>;
|
|
147
|
+
/**
|
|
148
|
+
* Fetch all child issues (sub-issues) of a parent issue
|
|
149
|
+
*
|
|
150
|
+
* @param issueIdOrIdentifier - The parent issue ID or identifier (e.g., "SUP-100")
|
|
151
|
+
* @returns Array of child issues
|
|
152
|
+
*/
|
|
153
|
+
getSubIssues(issueIdOrIdentifier: string): Promise<Issue[]>;
|
|
154
|
+
/**
|
|
155
|
+
* Check if an issue has a parent (is a child/sub-issue)
|
|
156
|
+
*
|
|
157
|
+
* @param issueIdOrIdentifier - The issue ID or identifier
|
|
158
|
+
* @returns True if the issue has a parent issue
|
|
159
|
+
*/
|
|
160
|
+
isChildIssue(issueIdOrIdentifier: string): Promise<boolean>;
|
|
161
|
+
/**
|
|
162
|
+
* Check if an issue has child issues (is a parent issue)
|
|
163
|
+
*
|
|
164
|
+
* @param issueIdOrIdentifier - The issue ID or identifier
|
|
165
|
+
* @returns True if the issue has at least one child issue
|
|
166
|
+
*/
|
|
167
|
+
isParentIssue(issueIdOrIdentifier: string): Promise<boolean>;
|
|
168
|
+
/**
|
|
169
|
+
* Get lightweight sub-issue statuses (no blocking relations)
|
|
170
|
+
*
|
|
171
|
+
* Returns identifier, title, and status for each sub-issue.
|
|
172
|
+
* Used by QA and acceptance agents to validate sub-issue completion
|
|
173
|
+
* without the overhead of fetching the full dependency graph.
|
|
174
|
+
*
|
|
175
|
+
* @param issueIdOrIdentifier - The parent issue ID or identifier
|
|
176
|
+
* @returns Array of sub-issue statuses
|
|
177
|
+
*/
|
|
178
|
+
getSubIssueStatuses(issueIdOrIdentifier: string): Promise<SubIssueStatus[]>;
|
|
179
|
+
/**
|
|
180
|
+
* Get sub-issues with their blocking relations for dependency graph building
|
|
181
|
+
*
|
|
182
|
+
* Builds a complete dependency graph of a parent issue's children, including
|
|
183
|
+
* which sub-issues block which other sub-issues. This is used by the coordinator
|
|
184
|
+
* agent to determine execution order.
|
|
185
|
+
*
|
|
186
|
+
* @param issueIdOrIdentifier - The parent issue ID or identifier
|
|
187
|
+
* @returns The sub-issue dependency graph
|
|
188
|
+
*/
|
|
189
|
+
getSubIssueGraph(issueIdOrIdentifier: string): Promise<SubIssueGraph>;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Create a configured LinearAgentClient instance
|
|
193
|
+
*/
|
|
194
|
+
export declare function createLinearAgentClient(config: LinearAgentClientConfig): LinearAgentClient;
|
|
195
|
+
//# sourceMappingURL=agent-client.d.ts.map
|
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