cyrus-core 0.0.6 → 0.0.8
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 +674 -21
- package/dist/CyrusAgentSession.d.ts +56 -0
- package/dist/CyrusAgentSession.d.ts.map +1 -0
- package/dist/CyrusAgentSession.js +6 -0
- package/dist/CyrusAgentSession.js.map +1 -0
- package/dist/PersistenceManager.d.ts +15 -39
- package/dist/PersistenceManager.d.ts.map +1 -1
- package/dist/PersistenceManager.js +31 -31
- package/dist/PersistenceManager.js.map +1 -1
- package/dist/index.d.ts +5 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/webhook-types.d.ts +97 -13
- package/dist/webhook-types.d.ts.map +1 -1
- package/dist/webhook-types.js +10 -4
- package/dist/webhook-types.js.map +1 -1
- package/package.json +6 -3
- package/dist/Session.d.ts +0 -96
- package/dist/Session.d.ts.map +0 -1
- package/dist/Session.js +0 -168
- package/dist/Session.js.map +0 -1
- package/dist/SessionManager.d.ts +0 -91
- package/dist/SessionManager.d.ts.map +0 -1
- package/dist/SessionManager.js +0 -222
- package/dist/SessionManager.js.map +0 -1
package/dist/Session.d.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import type { ChildProcess } from 'child_process';
|
|
2
|
-
export interface Issue {
|
|
3
|
-
id: string;
|
|
4
|
-
identifier: string;
|
|
5
|
-
title: string;
|
|
6
|
-
description?: string;
|
|
7
|
-
getBranchName(): string;
|
|
8
|
-
}
|
|
9
|
-
export interface Workspace {
|
|
10
|
-
path: string;
|
|
11
|
-
isGitWorktree: boolean;
|
|
12
|
-
historyPath?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface SessionOptions {
|
|
15
|
-
issue: Issue;
|
|
16
|
-
workspace: Workspace;
|
|
17
|
-
process?: ChildProcess | null;
|
|
18
|
-
startedAt?: Date | string;
|
|
19
|
-
exitCode?: number | null;
|
|
20
|
-
exitedAt?: Date | string | null;
|
|
21
|
-
stderrContent?: string;
|
|
22
|
-
lastAssistantResponse?: string;
|
|
23
|
-
lastCommentId?: string | null;
|
|
24
|
-
conversationContext?: any;
|
|
25
|
-
agentRootCommentId?: string | null;
|
|
26
|
-
currentParentId?: string | null;
|
|
27
|
-
streamingCommentId?: string | null;
|
|
28
|
-
streamingSynthesis?: string | null;
|
|
29
|
-
streamingNarrative?: NarrativeItem[];
|
|
30
|
-
claudeSessionId?: string | null;
|
|
31
|
-
}
|
|
32
|
-
export interface NarrativeItem {
|
|
33
|
-
type: 'text' | 'tool_call';
|
|
34
|
-
content?: string;
|
|
35
|
-
tool?: string;
|
|
36
|
-
timestamp: number;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Represents a Claude session for a comment thread
|
|
40
|
-
*/
|
|
41
|
-
export declare class Session {
|
|
42
|
-
issue: Issue;
|
|
43
|
-
workspace: Workspace;
|
|
44
|
-
process: ChildProcess | null;
|
|
45
|
-
startedAt: Date;
|
|
46
|
-
exitCode: number | null;
|
|
47
|
-
exitedAt: Date | null;
|
|
48
|
-
stderrContent: string;
|
|
49
|
-
lastAssistantResponse: string;
|
|
50
|
-
lastCommentId: string | null;
|
|
51
|
-
conversationContext: any;
|
|
52
|
-
agentRootCommentId: string | null;
|
|
53
|
-
currentParentId: string | null;
|
|
54
|
-
streamingCommentId: string | null;
|
|
55
|
-
streamingSynthesis: string | null;
|
|
56
|
-
streamingNarrative: NarrativeItem[];
|
|
57
|
-
claudeSessionId: string | null;
|
|
58
|
-
constructor({ issue, workspace, process, startedAt, exitCode, exitedAt, stderrContent, lastAssistantResponse, lastCommentId, conversationContext, agentRootCommentId, currentParentId, streamingCommentId, streamingSynthesis, streamingNarrative, claudeSessionId, }: SessionOptions);
|
|
59
|
-
/**
|
|
60
|
-
* Check if this session is currently active
|
|
61
|
-
*/
|
|
62
|
-
isActive(): boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Check if this session has exited successfully
|
|
65
|
-
*/
|
|
66
|
-
hasExitedSuccessfully(): boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Check if this session has exited with an error
|
|
69
|
-
*/
|
|
70
|
-
hasExitedWithError(): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Format an error message for posting to Linear
|
|
73
|
-
*/
|
|
74
|
-
formatErrorMessage(): string;
|
|
75
|
-
/**
|
|
76
|
-
* Add a tool call to the narrative
|
|
77
|
-
*/
|
|
78
|
-
addToolCall(toolName: string): void;
|
|
79
|
-
/**
|
|
80
|
-
* Add a text snippet to the narrative
|
|
81
|
-
*/
|
|
82
|
-
addTextSnippet(text: string): void;
|
|
83
|
-
/**
|
|
84
|
-
* Extract a short preview from text content
|
|
85
|
-
*/
|
|
86
|
-
private extractTextPreview;
|
|
87
|
-
/**
|
|
88
|
-
* Update the streaming synthesis based on chronological narrative
|
|
89
|
-
*/
|
|
90
|
-
updateStreamingSynthesis(): void;
|
|
91
|
-
/**
|
|
92
|
-
* Reset streaming state for a new run
|
|
93
|
-
*/
|
|
94
|
-
resetStreamingState(): void;
|
|
95
|
-
}
|
|
96
|
-
//# sourceMappingURL=Session.d.ts.map
|
package/dist/Session.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Session.d.ts","sourceRoot":"","sources":["../src/Session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,IAAI,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,OAAO,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,cA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AAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,mBAAmB,EAAE,GAAG,CAAA;IACxB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,kBAAkB,EAAE,aAAa,EAAE,CAAA;IACnC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;gBAElB,EACV,KAAK,EACL,SAAS,EACT,OAAc,EACd,SAAsB,EACtB,QAAe,EACf,QAAe,EACf,aAAkB,EAClB,qBAA0B,EAC1B,aAAoB,EACpB,mBAA0B,EAC1B,kBAAyB,EACzB,eAAsB,EACtB,kBAAyB,EACzB,kBAAyB,EACzB,kBAAuB,EACvB,eAAsB,GACvB,EAAE,cAAc;IAmBjB;;OAEG;IACH,QAAQ,IAAI,OAAO;IAInB;;OAEG;IACH,qBAAqB,IAAI,OAAO;IAIhC;;OAEG;IACH,kBAAkB,IAAI,OAAO;IAI7B;;OAEG;IACH,kBAAkB,IAAI,MAAM;IAY5B;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IASnC;;OAEG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAUlC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAgB1B;;OAEG;IACH,wBAAwB,IAAI,IAAI;IA2DhC;;OAEG;IACH,mBAAmB,IAAI,IAAI;CAI5B"}
|
package/dist/Session.js
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a Claude session for a comment thread
|
|
3
|
-
*/
|
|
4
|
-
export class Session {
|
|
5
|
-
issue;
|
|
6
|
-
workspace;
|
|
7
|
-
process;
|
|
8
|
-
startedAt;
|
|
9
|
-
exitCode;
|
|
10
|
-
exitedAt;
|
|
11
|
-
stderrContent;
|
|
12
|
-
lastAssistantResponse;
|
|
13
|
-
lastCommentId;
|
|
14
|
-
conversationContext;
|
|
15
|
-
agentRootCommentId;
|
|
16
|
-
currentParentId;
|
|
17
|
-
streamingCommentId;
|
|
18
|
-
streamingSynthesis;
|
|
19
|
-
streamingNarrative;
|
|
20
|
-
claudeSessionId; // Claude Code session ID for resume functionality
|
|
21
|
-
constructor({ issue, workspace, process = null, startedAt = new Date(), exitCode = null, exitedAt = null, stderrContent = '', lastAssistantResponse = '', lastCommentId = null, conversationContext = null, agentRootCommentId = null, currentParentId = null, streamingCommentId = null, streamingSynthesis = null, streamingNarrative = [], claudeSessionId = null, }) {
|
|
22
|
-
this.issue = issue;
|
|
23
|
-
this.workspace = workspace;
|
|
24
|
-
this.process = process;
|
|
25
|
-
this.startedAt = startedAt instanceof Date ? startedAt : new Date(startedAt);
|
|
26
|
-
this.exitCode = exitCode;
|
|
27
|
-
this.exitedAt = exitedAt instanceof Date ? exitedAt : exitedAt ? new Date(exitedAt) : null;
|
|
28
|
-
this.stderrContent = stderrContent;
|
|
29
|
-
this.lastAssistantResponse = lastAssistantResponse;
|
|
30
|
-
this.lastCommentId = lastCommentId;
|
|
31
|
-
this.conversationContext = conversationContext;
|
|
32
|
-
this.agentRootCommentId = agentRootCommentId;
|
|
33
|
-
this.currentParentId = currentParentId;
|
|
34
|
-
this.streamingCommentId = streamingCommentId;
|
|
35
|
-
this.streamingSynthesis = streamingSynthesis;
|
|
36
|
-
this.streamingNarrative = streamingNarrative;
|
|
37
|
-
this.claudeSessionId = claudeSessionId;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Check if this session is currently active
|
|
41
|
-
*/
|
|
42
|
-
isActive() {
|
|
43
|
-
return this.process !== null && !this.process.killed && this.exitCode === null;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Check if this session has exited successfully
|
|
47
|
-
*/
|
|
48
|
-
hasExitedSuccessfully() {
|
|
49
|
-
return this.exitCode === 0;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Check if this session has exited with an error
|
|
53
|
-
*/
|
|
54
|
-
hasExitedWithError() {
|
|
55
|
-
return this.exitCode !== null && this.exitCode !== 0;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Format an error message for posting to Linear
|
|
59
|
-
*/
|
|
60
|
-
formatErrorMessage() {
|
|
61
|
-
let errorMessage = `Claude process for issue ${this.issue.identifier} exited unexpectedly with code ${this.exitCode}.`;
|
|
62
|
-
if (this.stderrContent) {
|
|
63
|
-
errorMessage += `\n\n**Error details (stderr):**\n\`\`\`\n${this.stderrContent.substring(0, 1500)} ${this.stderrContent.length > 1500 ? '... (truncated)' : ''}\n\`\`\``;
|
|
64
|
-
}
|
|
65
|
-
return errorMessage;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Add a tool call to the narrative
|
|
69
|
-
*/
|
|
70
|
-
addToolCall(toolName) {
|
|
71
|
-
this.streamingNarrative.push({
|
|
72
|
-
type: 'tool_call',
|
|
73
|
-
tool: toolName,
|
|
74
|
-
timestamp: Date.now()
|
|
75
|
-
});
|
|
76
|
-
this.updateStreamingSynthesis();
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Add a text snippet to the narrative
|
|
80
|
-
*/
|
|
81
|
-
addTextSnippet(text) {
|
|
82
|
-
this.streamingNarrative.push({
|
|
83
|
-
type: 'text',
|
|
84
|
-
content: text,
|
|
85
|
-
timestamp: Date.now()
|
|
86
|
-
});
|
|
87
|
-
this.updateStreamingSynthesis();
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Extract a short preview from text content
|
|
91
|
-
*/
|
|
92
|
-
extractTextPreview(text) {
|
|
93
|
-
if (!text || typeof text !== 'string')
|
|
94
|
-
return '';
|
|
95
|
-
// Remove extra whitespace and newlines
|
|
96
|
-
const cleaned = text.replace(/\s+/g, ' ').trim();
|
|
97
|
-
// Return first meaningful sentence or truncate at reasonable length
|
|
98
|
-
const firstSentence = cleaned.match(/^[^.!?]*[.!?]/);
|
|
99
|
-
if (firstSentence && firstSentence[0].length <= 100) {
|
|
100
|
-
return firstSentence[0];
|
|
101
|
-
}
|
|
102
|
-
// Truncate to reasonable length
|
|
103
|
-
return cleaned.length > 80 ? cleaned.substring(0, 77) + '...' : cleaned;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Update the streaming synthesis based on chronological narrative
|
|
107
|
-
*/
|
|
108
|
-
updateStreamingSynthesis() {
|
|
109
|
-
const entries = [];
|
|
110
|
-
// Process all narrative items chronologically
|
|
111
|
-
let i = 0;
|
|
112
|
-
while (i < this.streamingNarrative.length) {
|
|
113
|
-
const item = this.streamingNarrative[i];
|
|
114
|
-
if (!item) {
|
|
115
|
-
i++;
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
if (item.type === 'text' && item.content) {
|
|
119
|
-
// Extract preview and add as entry
|
|
120
|
-
const preview = this.extractTextPreview(item.content);
|
|
121
|
-
if (preview) {
|
|
122
|
-
entries.push(preview);
|
|
123
|
-
}
|
|
124
|
-
i++;
|
|
125
|
-
}
|
|
126
|
-
else if (item.type === 'tool_call') {
|
|
127
|
-
// Collect all consecutive tool calls
|
|
128
|
-
const consecutiveTools = [];
|
|
129
|
-
let j = i;
|
|
130
|
-
while (j < this.streamingNarrative.length) {
|
|
131
|
-
const narrativeItem = this.streamingNarrative[j];
|
|
132
|
-
if (!narrativeItem || narrativeItem.type !== 'tool_call') {
|
|
133
|
-
break;
|
|
134
|
-
}
|
|
135
|
-
const toolName = narrativeItem.tool;
|
|
136
|
-
if (toolName && !consecutiveTools.includes(toolName)) {
|
|
137
|
-
consecutiveTools.push(toolName);
|
|
138
|
-
}
|
|
139
|
-
j++;
|
|
140
|
-
}
|
|
141
|
-
// Add grouped tool call summary
|
|
142
|
-
const toolCount = consecutiveTools.length;
|
|
143
|
-
const toolList = consecutiveTools.join(', ');
|
|
144
|
-
entries.push(`${toolCount} tool call${toolCount > 1 ? 's' : ''}: ${toolList}`);
|
|
145
|
-
// Move index to the next non-tool-call item
|
|
146
|
-
i = j;
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
i++;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
// Build chronological synthesis showing all entries
|
|
153
|
-
const synthesis = ['Getting to work...'];
|
|
154
|
-
// Add all entries (don't truncate to show complete chronology)
|
|
155
|
-
for (const entry of entries) {
|
|
156
|
-
synthesis.push(entry);
|
|
157
|
-
}
|
|
158
|
-
this.streamingSynthesis = synthesis.join('\n\n');
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Reset streaming state for a new run
|
|
162
|
-
*/
|
|
163
|
-
resetStreamingState() {
|
|
164
|
-
this.streamingNarrative = [];
|
|
165
|
-
this.streamingSynthesis = 'Getting to work...';
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
//# sourceMappingURL=Session.js.map
|
package/dist/Session.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Session.js","sourceRoot":"","sources":["../src/Session.ts"],"names":[],"mappings":"AA0CA;;GAEG;AACH,MAAM,OAAO,OAAO;IAClB,KAAK,CAAO;IACZ,SAAS,CAAW;IACpB,OAAO,CAAqB;IAC5B,SAAS,CAAM;IACf,QAAQ,CAAe;IACvB,QAAQ,CAAa;IACrB,aAAa,CAAQ;IACrB,qBAAqB,CAAQ;IAC7B,aAAa,CAAe;IAC5B,mBAAmB,CAAK;IACxB,kBAAkB,CAAe;IACjC,eAAe,CAAe;IAC9B,kBAAkB,CAAe;IACjC,kBAAkB,CAAe;IACjC,kBAAkB,CAAiB;IACnC,eAAe,CAAe,CAAE,kDAAkD;IAElF,YAAY,EACV,KAAK,EACL,SAAS,EACT,OAAO,GAAG,IAAI,EACd,SAAS,GAAG,IAAI,IAAI,EAAE,EACtB,QAAQ,GAAG,IAAI,EACf,QAAQ,GAAG,IAAI,EACf,aAAa,GAAG,EAAE,EAClB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AED,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAClD,CAAC;IAED;;OAEG;IACH,mBAAmB;QACjB,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAA;QAC5B,IAAI,CAAC,kBAAkB,GAAG,oBAAoB,CAAA;IAChD,CAAC;CACF"}
|
package/dist/SessionManager.d.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { Session } from './Session.js';
|
|
2
|
-
import { PersistenceManager } from './PersistenceManager.js';
|
|
3
|
-
import type { SerializableSession } from './PersistenceManager.js';
|
|
4
|
-
/**
|
|
5
|
-
* Manages active Claude sessions
|
|
6
|
-
* Now supports comment-based session mapping (one session per comment thread)
|
|
7
|
-
*/
|
|
8
|
-
export declare class SessionManager {
|
|
9
|
-
private sessionsByCommentId;
|
|
10
|
-
private sessionsByIssueId;
|
|
11
|
-
constructor(_persistenceManager?: PersistenceManager);
|
|
12
|
-
/**
|
|
13
|
-
* Add a session by comment ID (primary method)
|
|
14
|
-
*/
|
|
15
|
-
addSession(commentId: string, session: Session): void;
|
|
16
|
-
/**
|
|
17
|
-
* Get a session by comment ID
|
|
18
|
-
*/
|
|
19
|
-
getSession(commentId: string): Session | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Get all sessions for an issue ID
|
|
22
|
-
*/
|
|
23
|
-
getSessionsForIssue(issueId: string): Session[];
|
|
24
|
-
/**
|
|
25
|
-
* Check if a session exists for a comment ID
|
|
26
|
-
*/
|
|
27
|
-
hasSession(commentId: string): boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Check if any sessions exist for an issue ID
|
|
30
|
-
*/
|
|
31
|
-
hasSessionsForIssue(issueId: string): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Remove a session by comment ID
|
|
34
|
-
*/
|
|
35
|
-
removeSession(commentId: string): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Remove all sessions for an issue ID
|
|
38
|
-
*/
|
|
39
|
-
removeSessionsForIssue(issueId: string): number;
|
|
40
|
-
/**
|
|
41
|
-
* Get all sessions (by comment ID)
|
|
42
|
-
*/
|
|
43
|
-
getAllSessions(): Map<string, Session>;
|
|
44
|
-
/**
|
|
45
|
-
* Get all sessions grouped by issue ID
|
|
46
|
-
*/
|
|
47
|
-
getAllSessionsByIssue(): Map<string, Session[]>;
|
|
48
|
-
/**
|
|
49
|
-
* Update a session by comment ID
|
|
50
|
-
*/
|
|
51
|
-
updateSession(commentId: string, session: Session): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Get all active sessions
|
|
54
|
-
*/
|
|
55
|
-
getActiveSessions(): Array<[string, Session]>;
|
|
56
|
-
/**
|
|
57
|
-
* Get all active sessions for a specific issue
|
|
58
|
-
*/
|
|
59
|
-
getActiveSessionsForIssue(issueId: string): Session[];
|
|
60
|
-
/**
|
|
61
|
-
* Count active sessions
|
|
62
|
-
*/
|
|
63
|
-
countActiveSessions(): number;
|
|
64
|
-
/**
|
|
65
|
-
* Count active sessions for a specific issue
|
|
66
|
-
*/
|
|
67
|
-
countActiveSessionsForIssue(issueId: string): number;
|
|
68
|
-
/**
|
|
69
|
-
* Serialize sessions to a format suitable for persistence
|
|
70
|
-
*/
|
|
71
|
-
serializeSessions(): {
|
|
72
|
-
sessionsByCommentId: Record<string, SerializableSession>;
|
|
73
|
-
sessionsByIssueId: Record<string, SerializableSession[]>;
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* Restore sessions from serialized data
|
|
77
|
-
*/
|
|
78
|
-
deserializeSessions(data: {
|
|
79
|
-
sessionsByCommentId: Record<string, SerializableSession>;
|
|
80
|
-
sessionsByIssueId: Record<string, SerializableSession[]>;
|
|
81
|
-
}): void;
|
|
82
|
-
/**
|
|
83
|
-
* Convert a Session to SerializableSession
|
|
84
|
-
*/
|
|
85
|
-
private serializeSession;
|
|
86
|
-
/**
|
|
87
|
-
* Convert a SerializableSession to Session
|
|
88
|
-
*/
|
|
89
|
-
private deserializeSession;
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=SessionManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SessionManager.d.ts","sourceRoot":"","sources":["../src/SessionManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAElE;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,mBAAmB,CAAsB;IACjD,OAAO,CAAC,iBAAiB,CAAwB;gBAGrC,mBAAmB,CAAC,EAAE,kBAAkB;IAMpD;;OAEG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAWrD;;OAEG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAIlD;;OAEG;IACH,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE;IAI/C;;OAEG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAItC;;OAEG;IACH,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAI7C;;OAEG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAuBzC;;OAEG;IACH,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAmB/C;;OAEG;IACH,cAAc,IAAI,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAItC;;OAEG;IACH,qBAAqB,IAAI,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;IAI/C;;OAEG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO;IAW3D;;OAEG;IACH,iBAAiB,IAAI,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAI7C;;OAEG;IACH,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE;IAIrD;;OAEG;IACH,mBAAmB,IAAI,MAAM;IAI7B;;OAEG;IACH,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAIpD;;OAEG;IACH,iBAAiB,IAAI;QAAE,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;QAAC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAA;KAAE;IAiB3I;;OAEG;IACH,mBAAmB,CAAC,IAAI,EAAE;QAAE,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;QAAC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAA;KAAE,GAAG,IAAI;IAkBvJ;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAmBxB;;OAEG;IACH,OAAO,CAAC,kBAAkB;CAsB3B"}
|
package/dist/SessionManager.js
DELETED
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import { Session } from './Session.js';
|
|
2
|
-
/**
|
|
3
|
-
* Manages active Claude sessions
|
|
4
|
-
* Now supports comment-based session mapping (one session per comment thread)
|
|
5
|
-
*/
|
|
6
|
-
export class SessionManager {
|
|
7
|
-
sessionsByCommentId;
|
|
8
|
-
sessionsByIssueId;
|
|
9
|
-
// private persistenceManager: PersistenceManager // Reserved for future use
|
|
10
|
-
constructor(_persistenceManager) {
|
|
11
|
-
this.sessionsByCommentId = new Map();
|
|
12
|
-
this.sessionsByIssueId = new Map();
|
|
13
|
-
// this.persistenceManager = persistenceManager || new PersistenceManager() // Reserved for future use
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Add a session by comment ID (primary method)
|
|
17
|
-
*/
|
|
18
|
-
addSession(commentId, session) {
|
|
19
|
-
this.sessionsByCommentId.set(commentId, session);
|
|
20
|
-
// Also maintain issue ID mapping for lookup
|
|
21
|
-
const issueId = session.issue.id;
|
|
22
|
-
if (!this.sessionsByIssueId.has(issueId)) {
|
|
23
|
-
this.sessionsByIssueId.set(issueId, []);
|
|
24
|
-
}
|
|
25
|
-
this.sessionsByIssueId.get(issueId).push(session);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Get a session by comment ID
|
|
29
|
-
*/
|
|
30
|
-
getSession(commentId) {
|
|
31
|
-
return this.sessionsByCommentId.get(commentId);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Get all sessions for an issue ID
|
|
35
|
-
*/
|
|
36
|
-
getSessionsForIssue(issueId) {
|
|
37
|
-
return this.sessionsByIssueId.get(issueId) || [];
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Check if a session exists for a comment ID
|
|
41
|
-
*/
|
|
42
|
-
hasSession(commentId) {
|
|
43
|
-
return this.sessionsByCommentId.has(commentId);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Check if any sessions exist for an issue ID
|
|
47
|
-
*/
|
|
48
|
-
hasSessionsForIssue(issueId) {
|
|
49
|
-
return this.sessionsByIssueId.has(issueId) && this.sessionsByIssueId.get(issueId).length > 0;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Remove a session by comment ID
|
|
53
|
-
*/
|
|
54
|
-
removeSession(commentId) {
|
|
55
|
-
const session = this.sessionsByCommentId.get(commentId);
|
|
56
|
-
if (!session)
|
|
57
|
-
return false;
|
|
58
|
-
// Remove from comment mapping
|
|
59
|
-
this.sessionsByCommentId.delete(commentId);
|
|
60
|
-
// Remove from issue mapping
|
|
61
|
-
const issueId = session.issue.id;
|
|
62
|
-
const issueSessions = this.sessionsByIssueId.get(issueId);
|
|
63
|
-
if (issueSessions) {
|
|
64
|
-
const index = issueSessions.indexOf(session);
|
|
65
|
-
if (index !== -1) {
|
|
66
|
-
issueSessions.splice(index, 1);
|
|
67
|
-
if (issueSessions.length === 0) {
|
|
68
|
-
this.sessionsByIssueId.delete(issueId);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Remove all sessions for an issue ID
|
|
76
|
-
*/
|
|
77
|
-
removeSessionsForIssue(issueId) {
|
|
78
|
-
const sessions = this.sessionsByIssueId.get(issueId) || [];
|
|
79
|
-
let removedCount = 0;
|
|
80
|
-
for (const session of sessions) {
|
|
81
|
-
// Find the comment ID for this session
|
|
82
|
-
for (const [commentId, sessionObj] of this.sessionsByCommentId.entries()) {
|
|
83
|
-
if (sessionObj === session) {
|
|
84
|
-
this.sessionsByCommentId.delete(commentId);
|
|
85
|
-
removedCount++;
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
this.sessionsByIssueId.delete(issueId);
|
|
91
|
-
return removedCount;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Get all sessions (by comment ID)
|
|
95
|
-
*/
|
|
96
|
-
getAllSessions() {
|
|
97
|
-
return this.sessionsByCommentId;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Get all sessions grouped by issue ID
|
|
101
|
-
*/
|
|
102
|
-
getAllSessionsByIssue() {
|
|
103
|
-
return this.sessionsByIssueId;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Update a session by comment ID
|
|
107
|
-
*/
|
|
108
|
-
updateSession(commentId, session) {
|
|
109
|
-
if (!this.sessionsByCommentId.has(commentId)) {
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
// Remove old session and add new one to maintain consistency
|
|
113
|
-
this.removeSession(commentId);
|
|
114
|
-
this.addSession(commentId, session);
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Get all active sessions
|
|
119
|
-
*/
|
|
120
|
-
getActiveSessions() {
|
|
121
|
-
return Array.from(this.sessionsByCommentId.entries()).filter(([_, session]) => session.isActive());
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Get all active sessions for a specific issue
|
|
125
|
-
*/
|
|
126
|
-
getActiveSessionsForIssue(issueId) {
|
|
127
|
-
return this.getSessionsForIssue(issueId).filter(session => session.isActive());
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Count active sessions
|
|
131
|
-
*/
|
|
132
|
-
countActiveSessions() {
|
|
133
|
-
return this.getActiveSessions().length;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Count active sessions for a specific issue
|
|
137
|
-
*/
|
|
138
|
-
countActiveSessionsForIssue(issueId) {
|
|
139
|
-
return this.getActiveSessionsForIssue(issueId).length;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Serialize sessions to a format suitable for persistence
|
|
143
|
-
*/
|
|
144
|
-
serializeSessions() {
|
|
145
|
-
const sessionsByCommentId = {};
|
|
146
|
-
const sessionsByIssueId = {};
|
|
147
|
-
// Serialize sessionsByCommentId
|
|
148
|
-
for (const [commentId, session] of this.sessionsByCommentId.entries()) {
|
|
149
|
-
sessionsByCommentId[commentId] = this.serializeSession(session);
|
|
150
|
-
}
|
|
151
|
-
// Serialize sessionsByIssueId
|
|
152
|
-
for (const [issueId, sessions] of this.sessionsByIssueId.entries()) {
|
|
153
|
-
sessionsByIssueId[issueId] = sessions.map(session => this.serializeSession(session));
|
|
154
|
-
}
|
|
155
|
-
return { sessionsByCommentId, sessionsByIssueId };
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Restore sessions from serialized data
|
|
159
|
-
*/
|
|
160
|
-
deserializeSessions(data) {
|
|
161
|
-
// Clear existing sessions
|
|
162
|
-
this.sessionsByCommentId.clear();
|
|
163
|
-
this.sessionsByIssueId.clear();
|
|
164
|
-
// Restore sessionsByCommentId
|
|
165
|
-
for (const [commentId, serializedSession] of Object.entries(data.sessionsByCommentId)) {
|
|
166
|
-
const session = this.deserializeSession(serializedSession);
|
|
167
|
-
this.sessionsByCommentId.set(commentId, session);
|
|
168
|
-
}
|
|
169
|
-
// Restore sessionsByIssueId
|
|
170
|
-
for (const [issueId, serializedSessions] of Object.entries(data.sessionsByIssueId)) {
|
|
171
|
-
const sessions = serializedSessions.map(serializedSession => this.deserializeSession(serializedSession));
|
|
172
|
-
this.sessionsByIssueId.set(issueId, sessions);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Convert a Session to SerializableSession
|
|
177
|
-
*/
|
|
178
|
-
serializeSession(session) {
|
|
179
|
-
return {
|
|
180
|
-
issueId: session.issue.id,
|
|
181
|
-
issueIdentifier: session.issue.identifier,
|
|
182
|
-
issueTitle: session.issue.title,
|
|
183
|
-
branchName: session.issue.getBranchName(),
|
|
184
|
-
workspacePath: session.workspace.path,
|
|
185
|
-
isGitWorktree: session.workspace.isGitWorktree,
|
|
186
|
-
historyPath: session.workspace.historyPath,
|
|
187
|
-
claudeSessionId: session.claudeSessionId,
|
|
188
|
-
agentRootCommentId: session.agentRootCommentId,
|
|
189
|
-
lastCommentId: session.lastCommentId,
|
|
190
|
-
currentParentId: session.currentParentId,
|
|
191
|
-
startedAt: session.startedAt.toISOString(),
|
|
192
|
-
exitedAt: session.exitedAt?.toISOString() || null,
|
|
193
|
-
conversationContext: session.conversationContext
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Convert a SerializableSession to Session
|
|
198
|
-
*/
|
|
199
|
-
deserializeSession(serializedSession) {
|
|
200
|
-
return new Session({
|
|
201
|
-
issue: {
|
|
202
|
-
id: serializedSession.issueId,
|
|
203
|
-
identifier: serializedSession.issueIdentifier,
|
|
204
|
-
title: serializedSession.issueTitle,
|
|
205
|
-
getBranchName: () => serializedSession.branchName
|
|
206
|
-
},
|
|
207
|
-
workspace: {
|
|
208
|
-
path: serializedSession.workspacePath,
|
|
209
|
-
isGitWorktree: serializedSession.isGitWorktree,
|
|
210
|
-
historyPath: serializedSession.historyPath
|
|
211
|
-
},
|
|
212
|
-
claudeSessionId: serializedSession.claudeSessionId,
|
|
213
|
-
agentRootCommentId: serializedSession.agentRootCommentId,
|
|
214
|
-
lastCommentId: serializedSession.lastCommentId,
|
|
215
|
-
currentParentId: serializedSession.currentParentId,
|
|
216
|
-
startedAt: serializedSession.startedAt,
|
|
217
|
-
exitedAt: serializedSession.exitedAt,
|
|
218
|
-
conversationContext: serializedSession.conversationContext
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
//# sourceMappingURL=SessionManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SessionManager.js","sourceRoot":"","sources":["../src/SessionManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAItC;;;GAGG;AACH,MAAM,OAAO,cAAc;IACjB,mBAAmB,CAAsB;IACzC,iBAAiB,CAAwB;IACjD,4EAA4E;IAE5E,YAAY,mBAAwC;QAClD,IAAI,CAAC,mBAAmB,GAAG,IAAI,GAAG,EAAE,CAAA;QACpC,IAAI,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAAE,CAAA;QAClC,sGAAsG;IACxG,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,SAAiB,EAAE,OAAgB;QAC5C,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;QAEhD,4CAA4C;QAC5C,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,CAAA;QAChC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YACzC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;QACzC,CAAC;QACD,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,OA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