@renseiai/plugin-linear 0.8.6
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/README.md +91 -0
- package/dist/src/__tests__/subpath-exports.test.d.ts +2 -0
- package/dist/src/__tests__/subpath-exports.test.d.ts.map +1 -0
- package/dist/src/__tests__/subpath-exports.test.js +136 -0
- package/dist/src/agent-client-project-repo.test.d.ts +2 -0
- package/dist/src/agent-client-project-repo.test.d.ts.map +1 -0
- package/dist/src/agent-client-project-repo.test.js +153 -0
- package/dist/src/agent-client.d.ts +261 -0
- package/dist/src/agent-client.d.ts.map +1 -0
- package/dist/src/agent-client.js +902 -0
- package/dist/src/agent-session.d.ts +303 -0
- package/dist/src/agent-session.d.ts.map +1 -0
- package/dist/src/agent-session.js +969 -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/circuit-breaker.d.ts +76 -0
- package/dist/src/circuit-breaker.d.ts.map +1 -0
- package/dist/src/circuit-breaker.js +229 -0
- package/dist/src/circuit-breaker.test.d.ts +2 -0
- package/dist/src/circuit-breaker.test.d.ts.map +1 -0
- package/dist/src/circuit-breaker.test.js +292 -0
- package/dist/src/constants.d.ts +87 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +101 -0
- package/dist/src/defaults/auto-trigger.d.ts +35 -0
- package/dist/src/defaults/auto-trigger.d.ts.map +1 -0
- package/dist/src/defaults/auto-trigger.js +36 -0
- package/dist/src/defaults/index.d.ts +12 -0
- package/dist/src/defaults/index.d.ts.map +1 -0
- package/dist/src/defaults/index.js +11 -0
- package/dist/src/defaults/priority.d.ts +20 -0
- package/dist/src/defaults/priority.d.ts.map +1 -0
- package/dist/src/defaults/priority.js +38 -0
- package/dist/src/defaults/prompts.d.ts +42 -0
- package/dist/src/defaults/prompts.d.ts.map +1 -0
- package/dist/src/defaults/prompts.js +313 -0
- package/dist/src/defaults/prompts.test.d.ts +2 -0
- package/dist/src/defaults/prompts.test.d.ts.map +1 -0
- package/dist/src/defaults/prompts.test.js +263 -0
- package/dist/src/defaults/work-type-detection.d.ts +19 -0
- package/dist/src/defaults/work-type-detection.d.ts.map +1 -0
- package/dist/src/defaults/work-type-detection.js +98 -0
- package/dist/src/errors.d.ts +91 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +173 -0
- package/dist/src/frontend-adapter.d.ts +168 -0
- package/dist/src/frontend-adapter.d.ts.map +1 -0
- package/dist/src/frontend-adapter.js +314 -0
- package/dist/src/frontend-adapter.test.d.ts +2 -0
- package/dist/src/frontend-adapter.test.d.ts.map +1 -0
- package/dist/src/frontend-adapter.test.js +545 -0
- package/dist/src/index.d.ts +32 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +35 -0
- package/dist/src/issue-tracker-adapter.d.ts +113 -0
- package/dist/src/issue-tracker-adapter.d.ts.map +1 -0
- package/dist/src/issue-tracker-adapter.js +169 -0
- package/dist/src/issue-tracker-proxy.d.ts +140 -0
- package/dist/src/issue-tracker-proxy.d.ts.map +1 -0
- package/dist/src/issue-tracker-proxy.js +10 -0
- package/dist/src/platform-adapter.d.ts +132 -0
- package/dist/src/platform-adapter.d.ts.map +1 -0
- package/dist/src/platform-adapter.js +260 -0
- package/dist/src/platform-adapter.test.d.ts +2 -0
- package/dist/src/platform-adapter.test.d.ts.map +1 -0
- package/dist/src/platform-adapter.test.js +468 -0
- package/dist/src/proxy-client.d.ts +103 -0
- package/dist/src/proxy-client.d.ts.map +1 -0
- package/dist/src/proxy-client.js +191 -0
- package/dist/src/rate-limiter.d.ts +64 -0
- package/dist/src/rate-limiter.d.ts.map +1 -0
- package/dist/src/rate-limiter.js +163 -0
- package/dist/src/rate-limiter.test.d.ts +2 -0
- package/dist/src/rate-limiter.test.d.ts.map +1 -0
- package/dist/src/rate-limiter.test.js +217 -0
- package/dist/src/retry.d.ts +59 -0
- package/dist/src/retry.d.ts.map +1 -0
- package/dist/src/retry.js +82 -0
- package/dist/src/retry.test.d.ts +2 -0
- package/dist/src/retry.test.d.ts.map +1 -0
- package/dist/src/retry.test.js +266 -0
- package/dist/src/tools/deployment-bridge.d.ts +34 -0
- package/dist/src/tools/deployment-bridge.d.ts.map +1 -0
- package/dist/src/tools/deployment-bridge.js +122 -0
- package/dist/src/tools/linear-plugin.d.ts +23 -0
- package/dist/src/tools/linear-plugin.d.ts.map +1 -0
- package/dist/src/tools/linear-plugin.js +175 -0
- package/dist/src/tools/linear-runner.d.ts +37 -0
- package/dist/src/tools/linear-runner.d.ts.map +1 -0
- package/dist/src/tools/linear-runner.js +810 -0
- package/dist/src/types.d.ts +492 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +148 -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/dist/src/webhook-types.d.ts +308 -0
- package/dist/src/webhook-types.d.ts.map +1 -0
- package/dist/src/webhook-types.js +46 -0
- package/package.json +73 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Linear Issue Tracker Adapter
|
|
3
|
+
*
|
|
4
|
+
* Implements the platform-agnostic IssueTrackerClient interface
|
|
5
|
+
* by wrapping LinearAgentClient and AgentSession.
|
|
6
|
+
*
|
|
7
|
+
* Types are defined locally (structurally identical to core) to avoid
|
|
8
|
+
* a compile-time dependency on @renseiai/agentfactory.
|
|
9
|
+
*/
|
|
10
|
+
import { LinearAgentClient } from './agent-client.js';
|
|
11
|
+
import type { AgentWorkType } from './types.js';
|
|
12
|
+
/** Platform-agnostic issue representation. */
|
|
13
|
+
export interface IssueTrackerIssue {
|
|
14
|
+
id: string;
|
|
15
|
+
identifier: string;
|
|
16
|
+
title: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
url: string;
|
|
19
|
+
priority: number;
|
|
20
|
+
status?: string;
|
|
21
|
+
labels: string[];
|
|
22
|
+
teamName?: string;
|
|
23
|
+
projectName?: string;
|
|
24
|
+
}
|
|
25
|
+
/** Configuration for creating an issue tracker session. */
|
|
26
|
+
export interface SessionConfig {
|
|
27
|
+
issueId: string;
|
|
28
|
+
sessionId: string;
|
|
29
|
+
autoTransition?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** Platform-agnostic session for streaming agent activities. */
|
|
32
|
+
export interface IssueTrackerSession {
|
|
33
|
+
emitThought(content: string, ephemeral?: boolean): Promise<void>;
|
|
34
|
+
emitAction(tool: string, input: Record<string, unknown>, ephemeral?: boolean): Promise<void>;
|
|
35
|
+
emitToolResult(tool: string, output: string, ephemeral?: boolean): Promise<void>;
|
|
36
|
+
emitResponse(content: string): Promise<void>;
|
|
37
|
+
emitError(error: Error): Promise<void>;
|
|
38
|
+
reportEnvironmentIssue(title: string, description: string, options?: unknown): Promise<{
|
|
39
|
+
id: string;
|
|
40
|
+
identifier: string;
|
|
41
|
+
url: string;
|
|
42
|
+
} | null>;
|
|
43
|
+
setPullRequestUrl(url: string): Promise<void>;
|
|
44
|
+
addExternalUrl(url: {
|
|
45
|
+
url: string;
|
|
46
|
+
label: string;
|
|
47
|
+
}): Promise<void>;
|
|
48
|
+
complete(): Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
/** Comment chunk returned by buildCompletionComments. */
|
|
51
|
+
export interface CommentChunk {
|
|
52
|
+
body: string;
|
|
53
|
+
partNumber: number;
|
|
54
|
+
totalParts: number;
|
|
55
|
+
}
|
|
56
|
+
/** Platform-agnostic issue tracker client. */
|
|
57
|
+
export interface IssueTrackerClient {
|
|
58
|
+
getIssue(idOrIdentifier: string): Promise<IssueTrackerIssue>;
|
|
59
|
+
isParentIssue(issueId: string): Promise<boolean>;
|
|
60
|
+
createComment(issueId: string, body: string): Promise<{
|
|
61
|
+
id: string;
|
|
62
|
+
}>;
|
|
63
|
+
updateIssueStatus(issueId: string, status: string): Promise<void>;
|
|
64
|
+
unassignIssue(issueId: string): Promise<void>;
|
|
65
|
+
queryIssues(options: {
|
|
66
|
+
project?: string;
|
|
67
|
+
status?: string;
|
|
68
|
+
maxResults?: number;
|
|
69
|
+
}): Promise<IssueTrackerIssue[]>;
|
|
70
|
+
getProjectRepositoryUrl(projectName: string): Promise<string | null>;
|
|
71
|
+
createSession(config: SessionConfig): IssueTrackerSession;
|
|
72
|
+
buildCompletionComments(resultMessage: string, planItems: unknown[], sessionId: string | null): CommentChunk[];
|
|
73
|
+
}
|
|
74
|
+
/** Maps between workflow statuses and agent work types. */
|
|
75
|
+
export interface WorkTypeStatusMappings {
|
|
76
|
+
statusToWorkType: Record<string, AgentWorkType>;
|
|
77
|
+
workTypeStartStatus: Record<AgentWorkType, string | null>;
|
|
78
|
+
workTypeCompleteStatus: Record<AgentWorkType, string | null>;
|
|
79
|
+
workTypeFailStatus: Record<AgentWorkType, string | null>;
|
|
80
|
+
terminalStatuses: readonly string[];
|
|
81
|
+
workTypesRequiringWorktree: ReadonlySet<AgentWorkType>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Implements IssueTrackerClient by wrapping LinearAgentClient.
|
|
85
|
+
* Injected into the orchestrator at construction time.
|
|
86
|
+
*/
|
|
87
|
+
export declare class LinearIssueTrackerClient implements IssueTrackerClient {
|
|
88
|
+
readonly linearClient: LinearAgentClient;
|
|
89
|
+
constructor(config: {
|
|
90
|
+
apiKey: string;
|
|
91
|
+
});
|
|
92
|
+
getIssue(idOrIdentifier: string): Promise<IssueTrackerIssue>;
|
|
93
|
+
isParentIssue(issueId: string): Promise<boolean>;
|
|
94
|
+
createComment(issueId: string, body: string): Promise<{
|
|
95
|
+
id: string;
|
|
96
|
+
}>;
|
|
97
|
+
updateIssueStatus(issueId: string, status: string): Promise<void>;
|
|
98
|
+
unassignIssue(issueId: string): Promise<void>;
|
|
99
|
+
queryIssues(options: {
|
|
100
|
+
project?: string;
|
|
101
|
+
status?: string;
|
|
102
|
+
maxResults?: number;
|
|
103
|
+
}): Promise<IssueTrackerIssue[]>;
|
|
104
|
+
getProjectRepositoryUrl(projectName: string): Promise<string | null>;
|
|
105
|
+
createSession(config: SessionConfig): IssueTrackerSession;
|
|
106
|
+
buildCompletionComments(resultMessage: string, planItems: unknown[], sessionId: string | null): CommentChunk[];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Create the default Linear status mappings.
|
|
110
|
+
* These map between Linear workflow statuses and agent work types.
|
|
111
|
+
*/
|
|
112
|
+
export declare function createLinearStatusMappings(): WorkTypeStatusMappings;
|
|
113
|
+
//# sourceMappingURL=issue-tracker-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-tracker-adapter.d.ts","sourceRoot":"","sources":["../../src/issue-tracker-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,iBAAiB,EAA2B,MAAM,mBAAmB,CAAA;AAG9E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAe/C,8CAA8C;AAC9C,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,gEAAgE;AAChE,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,OAAO,EAAE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+
* Implements the platform-agnostic IssueTrackerClient interface
|
|
5
|
+
* by wrapping LinearAgentClient and AgentSession.
|
|
6
|
+
*
|
|
7
|
+
* Types are defined locally (structurally identical to core) to avoid
|
|
8
|
+
* a compile-time dependency on @renseiai/agentfactory.
|
|
9
|
+
*/
|
|
10
|
+
import { createLinearAgentClient } from './agent-client.js';
|
|
11
|
+
import { createAgentSession } from './agent-session.js';
|
|
12
|
+
import { buildCompletionComments } from './utils.js';
|
|
13
|
+
import { STATUS_WORK_TYPE_MAP, WORK_TYPE_START_STATUS, WORK_TYPE_COMPLETE_STATUS, WORK_TYPE_FAIL_STATUS, TERMINAL_STATUSES, WORK_TYPES_REQUIRING_WORKTREE, } from './types.js';
|
|
14
|
+
/**
|
|
15
|
+
* Wraps a Linear AgentSession to implement IssueTrackerSession.
|
|
16
|
+
*/
|
|
17
|
+
class LinearIssueTrackerSession {
|
|
18
|
+
session;
|
|
19
|
+
constructor(session) {
|
|
20
|
+
this.session = session;
|
|
21
|
+
}
|
|
22
|
+
async emitThought(content, ephemeral) {
|
|
23
|
+
await this.session.emitThought(content, ephemeral);
|
|
24
|
+
}
|
|
25
|
+
async emitAction(tool, input, ephemeral) {
|
|
26
|
+
await this.session.emitAction(tool, input, ephemeral);
|
|
27
|
+
}
|
|
28
|
+
async emitToolResult(tool, output, ephemeral) {
|
|
29
|
+
await this.session.emitToolResult(tool, output, ephemeral);
|
|
30
|
+
}
|
|
31
|
+
async emitResponse(content) {
|
|
32
|
+
await this.session.emitResponse(content);
|
|
33
|
+
}
|
|
34
|
+
async emitError(error) {
|
|
35
|
+
await this.session.emitError(error);
|
|
36
|
+
}
|
|
37
|
+
async reportEnvironmentIssue(title, description, options) {
|
|
38
|
+
return this.session.reportEnvironmentIssue(title, description, options);
|
|
39
|
+
}
|
|
40
|
+
async setPullRequestUrl(url) {
|
|
41
|
+
await this.session.setPullRequestUrl(url);
|
|
42
|
+
}
|
|
43
|
+
async addExternalUrl(url) {
|
|
44
|
+
await this.session.addExternalUrl(url.label, url.url);
|
|
45
|
+
}
|
|
46
|
+
async complete() {
|
|
47
|
+
await this.session.complete();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Implements IssueTrackerClient by wrapping LinearAgentClient.
|
|
52
|
+
* Injected into the orchestrator at construction time.
|
|
53
|
+
*/
|
|
54
|
+
export class LinearIssueTrackerClient {
|
|
55
|
+
linearClient;
|
|
56
|
+
constructor(config) {
|
|
57
|
+
this.linearClient = createLinearAgentClient({ apiKey: config.apiKey });
|
|
58
|
+
}
|
|
59
|
+
async getIssue(idOrIdentifier) {
|
|
60
|
+
const issue = await this.linearClient.getIssue(idOrIdentifier);
|
|
61
|
+
const state = await issue.state;
|
|
62
|
+
const team = await issue.team;
|
|
63
|
+
const project = await issue.project;
|
|
64
|
+
const labels = await issue.labels();
|
|
65
|
+
return {
|
|
66
|
+
id: issue.id,
|
|
67
|
+
identifier: issue.identifier,
|
|
68
|
+
title: issue.title,
|
|
69
|
+
description: issue.description ?? undefined,
|
|
70
|
+
url: issue.url,
|
|
71
|
+
priority: issue.priority,
|
|
72
|
+
status: state?.name,
|
|
73
|
+
labels: labels.nodes.map((l) => l.name),
|
|
74
|
+
teamName: team?.key,
|
|
75
|
+
projectName: project?.name,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
async isParentIssue(issueId) {
|
|
79
|
+
return this.linearClient.isParentIssue(issueId);
|
|
80
|
+
}
|
|
81
|
+
async createComment(issueId, body) {
|
|
82
|
+
const comment = await this.linearClient.createComment(issueId, body);
|
|
83
|
+
return { id: comment.id };
|
|
84
|
+
}
|
|
85
|
+
async updateIssueStatus(issueId, status) {
|
|
86
|
+
await this.linearClient.updateIssueStatus(issueId, status);
|
|
87
|
+
}
|
|
88
|
+
async unassignIssue(issueId) {
|
|
89
|
+
await this.linearClient.unassignIssue(issueId);
|
|
90
|
+
}
|
|
91
|
+
async queryIssues(options) {
|
|
92
|
+
const filter = {};
|
|
93
|
+
if (options.status) {
|
|
94
|
+
filter.state = { name: { eqIgnoreCase: options.status } };
|
|
95
|
+
}
|
|
96
|
+
if (options.project) {
|
|
97
|
+
const projects = await this.linearClient.linearClient.projects({
|
|
98
|
+
filter: { name: { eqIgnoreCase: options.project } },
|
|
99
|
+
});
|
|
100
|
+
if (projects.nodes.length > 0) {
|
|
101
|
+
filter.project = { id: { eq: projects.nodes[0].id } };
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const issues = await this.linearClient.linearClient.issues({
|
|
105
|
+
filter,
|
|
106
|
+
first: options.maxResults ?? 50,
|
|
107
|
+
});
|
|
108
|
+
const results = [];
|
|
109
|
+
for (const issue of issues.nodes) {
|
|
110
|
+
const state = await issue.state;
|
|
111
|
+
const team = await issue.team;
|
|
112
|
+
const project = await issue.project;
|
|
113
|
+
const labels = await issue.labels();
|
|
114
|
+
results.push({
|
|
115
|
+
id: issue.id,
|
|
116
|
+
identifier: issue.identifier,
|
|
117
|
+
title: issue.title,
|
|
118
|
+
description: issue.description ?? undefined,
|
|
119
|
+
url: issue.url,
|
|
120
|
+
priority: issue.priority,
|
|
121
|
+
status: state?.name,
|
|
122
|
+
labels: labels.nodes.map((l) => l.name),
|
|
123
|
+
teamName: team?.key,
|
|
124
|
+
projectName: project?.name,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
return results;
|
|
128
|
+
}
|
|
129
|
+
async getProjectRepositoryUrl(projectName) {
|
|
130
|
+
const projects = await this.linearClient.linearClient.projects({
|
|
131
|
+
filter: { name: { eqIgnoreCase: projectName } },
|
|
132
|
+
});
|
|
133
|
+
if (projects.nodes.length === 0)
|
|
134
|
+
return null;
|
|
135
|
+
// Use the LinearAgentClient's method if available
|
|
136
|
+
try {
|
|
137
|
+
return await this.linearClient.getProjectRepositoryUrl(projects.nodes[0].id);
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
createSession(config) {
|
|
144
|
+
const session = createAgentSession({
|
|
145
|
+
client: this.linearClient.linearClient,
|
|
146
|
+
issueId: config.issueId,
|
|
147
|
+
sessionId: config.sessionId,
|
|
148
|
+
autoTransition: config.autoTransition ?? false,
|
|
149
|
+
});
|
|
150
|
+
return new LinearIssueTrackerSession(session);
|
|
151
|
+
}
|
|
152
|
+
buildCompletionComments(resultMessage, planItems, sessionId) {
|
|
153
|
+
return buildCompletionComments(resultMessage, planItems, sessionId);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Create the default Linear status mappings.
|
|
158
|
+
* These map between Linear workflow statuses and agent work types.
|
|
159
|
+
*/
|
|
160
|
+
export function createLinearStatusMappings() {
|
|
161
|
+
return {
|
|
162
|
+
statusToWorkType: STATUS_WORK_TYPE_MAP,
|
|
163
|
+
workTypeStartStatus: WORK_TYPE_START_STATUS,
|
|
164
|
+
workTypeCompleteStatus: WORK_TYPE_COMPLETE_STATUS,
|
|
165
|
+
workTypeFailStatus: WORK_TYPE_FAIL_STATUS,
|
|
166
|
+
terminalStatuses: TERMINAL_STATUSES,
|
|
167
|
+
workTypesRequiringWorktree: WORK_TYPES_REQUIRING_WORKTREE,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-Agnostic Issue Tracker Proxy Interface
|
|
3
|
+
*
|
|
4
|
+
* Defines the contract between agents/governors and the centralized proxy.
|
|
5
|
+
* Agents call these methods without knowing whether the backend is Linear,
|
|
6
|
+
* Jira, GitHub Issues, or any future platform.
|
|
7
|
+
*
|
|
8
|
+
* The proxy translates these generic operations into platform-specific API calls.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Every proxy request carries authentication and workspace context.
|
|
12
|
+
*/
|
|
13
|
+
export interface ProxyRequest {
|
|
14
|
+
/** The operation to perform */
|
|
15
|
+
method: IssueTrackerMethod;
|
|
16
|
+
/** Arguments for the operation (method-specific) */
|
|
17
|
+
args: unknown[];
|
|
18
|
+
/** Workspace/organization ID for multi-tenant routing */
|
|
19
|
+
organizationId?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Standard proxy response envelope.
|
|
23
|
+
*/
|
|
24
|
+
export interface ProxyResponse<T = unknown> {
|
|
25
|
+
success: boolean;
|
|
26
|
+
data?: T;
|
|
27
|
+
error?: {
|
|
28
|
+
code: string;
|
|
29
|
+
message: string;
|
|
30
|
+
retryable: boolean;
|
|
31
|
+
};
|
|
32
|
+
/** Rate limit info from the upstream platform */
|
|
33
|
+
quota?: {
|
|
34
|
+
requestsRemaining?: number;
|
|
35
|
+
complexityRemaining?: number;
|
|
36
|
+
resetAt?: number;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* All operations that can be routed through the proxy.
|
|
41
|
+
*
|
|
42
|
+
* Named generically (not Linear-specific) so future platforms
|
|
43
|
+
* can implement the same interface.
|
|
44
|
+
*/
|
|
45
|
+
export type IssueTrackerMethod = 'getIssue' | 'updateIssue' | 'createIssue' | 'createComment' | 'getIssueComments' | 'getTeamStatuses' | 'updateIssueStatus' | 'createAgentActivity' | 'updateAgentSession' | 'createAgentSessionOnIssue' | 'createIssueRelation' | 'getIssueRelations' | 'deleteIssueRelation' | 'getSubIssues' | 'getSubIssueStatuses' | 'getSubIssueGraph' | 'isParentIssue' | 'isChildIssue' | 'listProjectIssues' | 'getProjectRepositoryUrl' | 'getViewer' | 'getTeam' | 'unassignIssue';
|
|
46
|
+
/**
|
|
47
|
+
* Serialized issue — all relations pre-resolved to plain JSON.
|
|
48
|
+
* No SDK-specific Promise fields or lazy loaders.
|
|
49
|
+
*/
|
|
50
|
+
export interface SerializedIssue {
|
|
51
|
+
id: string;
|
|
52
|
+
identifier: string;
|
|
53
|
+
title: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
url: string;
|
|
56
|
+
priority: number;
|
|
57
|
+
state?: {
|
|
58
|
+
id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
type: string;
|
|
61
|
+
};
|
|
62
|
+
labels: Array<{
|
|
63
|
+
id: string;
|
|
64
|
+
name: string;
|
|
65
|
+
}>;
|
|
66
|
+
assignee?: {
|
|
67
|
+
id: string;
|
|
68
|
+
name: string;
|
|
69
|
+
email?: string;
|
|
70
|
+
} | null;
|
|
71
|
+
team?: {
|
|
72
|
+
id: string;
|
|
73
|
+
name: string;
|
|
74
|
+
key: string;
|
|
75
|
+
};
|
|
76
|
+
parent?: {
|
|
77
|
+
id: string;
|
|
78
|
+
identifier: string;
|
|
79
|
+
} | null;
|
|
80
|
+
project?: {
|
|
81
|
+
id: string;
|
|
82
|
+
name: string;
|
|
83
|
+
} | null;
|
|
84
|
+
createdAt: string;
|
|
85
|
+
updatedAt: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Serialized comment.
|
|
89
|
+
*/
|
|
90
|
+
export interface SerializedComment {
|
|
91
|
+
id: string;
|
|
92
|
+
body: string;
|
|
93
|
+
createdAt: string;
|
|
94
|
+
updatedAt: string;
|
|
95
|
+
user?: {
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
} | null;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Serialized viewer (authenticated user).
|
|
102
|
+
*/
|
|
103
|
+
export interface SerializedViewer {
|
|
104
|
+
id: string;
|
|
105
|
+
name: string;
|
|
106
|
+
email: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Serialized team.
|
|
110
|
+
*/
|
|
111
|
+
export interface SerializedTeam {
|
|
112
|
+
id: string;
|
|
113
|
+
name: string;
|
|
114
|
+
key: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Health status for the proxy endpoint.
|
|
118
|
+
*/
|
|
119
|
+
export interface ProxyHealthStatus {
|
|
120
|
+
/** Whether the proxy can process requests */
|
|
121
|
+
healthy: boolean;
|
|
122
|
+
/** Circuit breaker state */
|
|
123
|
+
circuitBreaker: {
|
|
124
|
+
state: string;
|
|
125
|
+
failures: number;
|
|
126
|
+
msSinceOpened: number | null;
|
|
127
|
+
};
|
|
128
|
+
/** Rate limiter status */
|
|
129
|
+
rateLimiter: {
|
|
130
|
+
availableTokens: number;
|
|
131
|
+
};
|
|
132
|
+
/** Upstream platform quota from response headers */
|
|
133
|
+
quota: {
|
|
134
|
+
requestsRemaining: number | null;
|
|
135
|
+
complexityRemaining: number | null;
|
|
136
|
+
resetAt: number | null;
|
|
137
|
+
updatedAt: number;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=issue-tracker-proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-tracker-proxy.d.ts","sourceRoot":"","sources":["../../src/issue-tracker-proxy.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,+BAA+B;IAC/B,MAAM,EAAE,kBAAkB,CAAA;IAC1B,oDAAoD;IACpD,IAAI,EAAE,OAAO,EAAE,CAAA;IACf,yDAAyD;IACzD,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,OAAO;IACxC,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,CAAC,CAAA;IACR,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;QACf,SAAS,EAAE,OAAO,CAAA;KACnB,CAAA;IACD,iDAAiD;IACjD,KAAK,CAAC,EAAE;QACN,iBAAiB,CAAC,EAAE,MAAM,CAAA;QAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAA;QAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB,CAAA;CACF;AAMD;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAE1B,UAAU,G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
|
4
|
+
* Defines the contract between agents/governors and the centralized proxy.
|
|
5
|
+
* Agents call these methods without knowing whether the backend is Linear,
|
|
6
|
+
* Jira, GitHub Issues, or any future platform.
|
|
7
|
+
*
|
|
8
|
+
* The proxy translates these generic operations into platform-specific API calls.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LinearPlatformAdapter
|
|
3
|
+
*
|
|
4
|
+
* Extends LinearFrontendAdapter with Governor event integration methods.
|
|
5
|
+
* Structurally satisfies the PlatformAdapter interface from @renseiai/agentfactory
|
|
6
|
+
* without an explicit `implements` clause, avoiding a circular package dependency
|
|
7
|
+
* (core depends on linear, so linear cannot import core).
|
|
8
|
+
*
|
|
9
|
+
* Responsibilities:
|
|
10
|
+
* - Normalize Linear webhook payloads into GovernorEvents
|
|
11
|
+
* - Scan Linear projects for non-terminal issues
|
|
12
|
+
* - Convert Linear SDK Issue objects to GovernorIssue
|
|
13
|
+
*/
|
|
14
|
+
import { LinearFrontendAdapter } from './frontend-adapter.js';
|
|
15
|
+
import type { LinearAgentClient } from './agent-client.js';
|
|
16
|
+
/**
|
|
17
|
+
* Minimal issue representation used by the Governor.
|
|
18
|
+
* Structurally identical to GovernorIssue in @renseiai/agentfactory.
|
|
19
|
+
*/
|
|
20
|
+
export interface GovernorIssue {
|
|
21
|
+
id: string;
|
|
22
|
+
identifier: string;
|
|
23
|
+
title: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
status: string;
|
|
26
|
+
labels: string[];
|
|
27
|
+
createdAt: number;
|
|
28
|
+
parentId?: string;
|
|
29
|
+
project?: string;
|
|
30
|
+
}
|
|
31
|
+
/** Where an event originated. */
|
|
32
|
+
type EventSource = 'webhook' | 'poll' | 'manual';
|
|
33
|
+
/**
|
|
34
|
+
* Fired when an issue's workflow status changes.
|
|
35
|
+
* Structurally identical to IssueStatusChangedEvent in @renseiai/agentfactory.
|
|
36
|
+
*/
|
|
37
|
+
interface IssueStatusChangedEvent {
|
|
38
|
+
type: 'issue-status-changed';
|
|
39
|
+
issueId: string;
|
|
40
|
+
issue: GovernorIssue;
|
|
41
|
+
previousStatus?: string;
|
|
42
|
+
newStatus: string;
|
|
43
|
+
timestamp: string;
|
|
44
|
+
source: EventSource;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Fired when a comment is added to an issue.
|
|
48
|
+
* Structurally identical to CommentAddedEvent in @renseiai/agentfactory.
|
|
49
|
+
*/
|
|
50
|
+
interface CommentAddedEvent {
|
|
51
|
+
type: 'comment-added';
|
|
52
|
+
issueId: string;
|
|
53
|
+
issue: GovernorIssue;
|
|
54
|
+
commentId: string;
|
|
55
|
+
commentBody: string;
|
|
56
|
+
userId?: string;
|
|
57
|
+
userName?: string;
|
|
58
|
+
timestamp: string;
|
|
59
|
+
source: EventSource;
|
|
60
|
+
}
|
|
61
|
+
/** Union of events this adapter can produce. */
|
|
62
|
+
type GovernorEvent = IssueStatusChangedEvent | CommentAddedEvent;
|
|
63
|
+
/**
|
|
64
|
+
* Linear platform adapter for the EventDrivenGovernor.
|
|
65
|
+
*
|
|
66
|
+
* Extends LinearFrontendAdapter to inherit all frontend operations
|
|
67
|
+
* (status mapping, issue read/write, agent sessions) and adds
|
|
68
|
+
* Governor-specific methods for webhook normalization, project scanning,
|
|
69
|
+
* and issue conversion.
|
|
70
|
+
*
|
|
71
|
+
* Structurally satisfies PlatformAdapter from @renseiai/agentfactory.
|
|
72
|
+
*/
|
|
73
|
+
export declare class LinearPlatformAdapter extends LinearFrontendAdapter {
|
|
74
|
+
/**
|
|
75
|
+
* The underlying Linear client, exposed to subclass methods.
|
|
76
|
+
* Re-declared here because the parent's `client` field is private.
|
|
77
|
+
*/
|
|
78
|
+
private readonly linearAgentClient;
|
|
79
|
+
constructor(client: LinearAgentClient);
|
|
80
|
+
/**
|
|
81
|
+
* Normalize a raw Linear webhook payload into GovernorEvents.
|
|
82
|
+
*
|
|
83
|
+
* Handles two payload types:
|
|
84
|
+
* - Issue updates with state changes -> IssueStatusChangedEvent
|
|
85
|
+
* - Comment creations -> CommentAddedEvent
|
|
86
|
+
*
|
|
87
|
+
* Returns `null` for unrecognized payloads (e.g., label changes,
|
|
88
|
+
* AgentSession events, or other resource types).
|
|
89
|
+
*
|
|
90
|
+
* @param payload - Raw Linear webhook payload
|
|
91
|
+
* @returns Array of GovernorEvents, or null if not relevant
|
|
92
|
+
*/
|
|
93
|
+
normalizeWebhookEvent(payload: unknown): GovernorEvent[] | null;
|
|
94
|
+
/**
|
|
95
|
+
* Scan a Linear project for all non-terminal issues.
|
|
96
|
+
*
|
|
97
|
+
* Uses a single GraphQL query via `listProjectIssues()` to fetch all
|
|
98
|
+
* issue data in one API call, eliminating the N+1 problem of lazy-loading
|
|
99
|
+
* state/labels/parent/project for each issue.
|
|
100
|
+
*
|
|
101
|
+
* @param project - Linear project name to scan
|
|
102
|
+
* @returns Array of GovernorIssue for all active issues
|
|
103
|
+
*/
|
|
104
|
+
scanProjectIssues(project: string): Promise<GovernorIssue[]>;
|
|
105
|
+
/**
|
|
106
|
+
* Scan a project and return both GovernorIssues and a set of parent issue IDs.
|
|
107
|
+
*
|
|
108
|
+
* The parent issue IDs are derived from `childCount > 0` in the single
|
|
109
|
+
* GraphQL query, allowing callers to skip per-issue `isParentIssue()` API calls.
|
|
110
|
+
*
|
|
111
|
+
* @param project - Linear project name to scan
|
|
112
|
+
* @returns Issues and a set of parent issue IDs
|
|
113
|
+
*/
|
|
114
|
+
scanProjectIssuesWithParents(project: string): Promise<{
|
|
115
|
+
issues: GovernorIssue[];
|
|
116
|
+
parentIssueIds: Set<string>;
|
|
117
|
+
}>;
|
|
118
|
+
/**
|
|
119
|
+
* Convert a Linear SDK Issue object to a GovernorIssue.
|
|
120
|
+
*
|
|
121
|
+
* The `native` parameter is typed as `unknown` to satisfy the
|
|
122
|
+
* PlatformAdapter interface. Internally it is cast to the Linear SDK
|
|
123
|
+
* `Issue` type. Callers must ensure they pass a valid Linear Issue.
|
|
124
|
+
*
|
|
125
|
+
* @param native - Linear SDK Issue object
|
|
126
|
+
* @returns GovernorIssue representation
|
|
127
|
+
* @throws Error if the native object is not a valid Linear Issue
|
|
128
|
+
*/
|
|
129
|
+
toGovernorIssue(native: unknown): Promise<GovernorIssue>;
|
|
130
|
+
}
|
|
131
|
+
export {};
|
|
132
|
+
//# sourceMappingURL=platform-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-adapter.d.ts","sourceRoot":"","sources":["../../src/platform-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAY1D;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,iCAAiC;AACjC,KAAK,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAA;AAEhD;;;GAGG;AACH,UAAU,uBAAuB;IAC/B,IAAI,EAAE,sBAAsB,CAAA;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,aAAa,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,WAAW,CAAA;CACpB;AAED;;;GAGG;AACH,UAAU,iBAAiB;IACzB,IAAI,E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