cyrus-core 0.0.1

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ceedar
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,94 @@
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
+ }
31
+ export interface NarrativeItem {
32
+ type: 'text' | 'tool_call';
33
+ content?: string;
34
+ tool?: string;
35
+ timestamp: number;
36
+ }
37
+ /**
38
+ * Represents a Claude session for an issue
39
+ */
40
+ export declare class Session {
41
+ issue: Issue;
42
+ workspace: Workspace;
43
+ process: ChildProcess | null;
44
+ startedAt: Date;
45
+ exitCode: number | null;
46
+ exitedAt: Date | null;
47
+ stderrContent: string;
48
+ lastAssistantResponse: string;
49
+ lastCommentId: string | null;
50
+ conversationContext: any;
51
+ agentRootCommentId: string | null;
52
+ currentParentId: string | null;
53
+ streamingCommentId: string | null;
54
+ streamingSynthesis: string | null;
55
+ streamingNarrative: NarrativeItem[];
56
+ constructor({ issue, workspace, process, startedAt, exitCode, exitedAt, stderrContent, lastAssistantResponse, lastCommentId, conversationContext, agentRootCommentId, currentParentId, streamingCommentId, streamingSynthesis, streamingNarrative, }: SessionOptions);
57
+ /**
58
+ * Check if this session is currently active
59
+ */
60
+ isActive(): boolean;
61
+ /**
62
+ * Check if this session has exited successfully
63
+ */
64
+ hasExitedSuccessfully(): boolean;
65
+ /**
66
+ * Check if this session has exited with an error
67
+ */
68
+ hasExitedWithError(): boolean;
69
+ /**
70
+ * Format an error message for posting to Linear
71
+ */
72
+ formatErrorMessage(): string;
73
+ /**
74
+ * Add a tool call to the narrative
75
+ */
76
+ addToolCall(toolName: string): void;
77
+ /**
78
+ * Add a text snippet to the narrative
79
+ */
80
+ addTextSnippet(text: string): void;
81
+ /**
82
+ * Extract a short preview from text content
83
+ */
84
+ private extractTextPreview;
85
+ /**
86
+ * Update the streaming synthesis based on chronological narrative
87
+ */
88
+ updateStreamingSynthesis(): void;
89
+ /**
90
+ * Reset streaming state for a new run
91
+ */
92
+ resetStreamingState(): void;
93
+ }
94
+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IAUlC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAgB1B;;OAEG;IACH,wBAAwB,IAAI,IAAI;IA2DhC;;OAEG;IACH,mBAAmB,IAAI,IAAI;CAI5B"}
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Represents a Claude session for an issue
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
+ 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 = [], }) {
21
+ this.issue = issue;
22
+ this.workspace = workspace;
23
+ this.process = process;
24
+ this.startedAt = startedAt instanceof Date ? startedAt : new Date(startedAt);
25
+ this.exitCode = exitCode;
26
+ this.exitedAt = exitedAt instanceof Date ? exitedAt : exitedAt ? new Date(exitedAt) : null;
27
+ this.stderrContent = stderrContent;
28
+ this.lastAssistantResponse = lastAssistantResponse;
29
+ this.lastCommentId = lastCommentId;
30
+ this.conversationContext = conversationContext;
31
+ this.agentRootCommentId = agentRootCommentId;
32
+ this.currentParentId = currentParentId;
33
+ this.streamingCommentId = streamingCommentId;
34
+ this.streamingSynthesis = streamingSynthesis;
35
+ this.streamingNarrative = streamingNarrative;
36
+ }
37
+ /**
38
+ * Check if this session is currently active
39
+ */
40
+ isActive() {
41
+ return this.process !== null && !this.process.killed && this.exitCode === null;
42
+ }
43
+ /**
44
+ * Check if this session has exited successfully
45
+ */
46
+ hasExitedSuccessfully() {
47
+ return this.exitCode === 0;
48
+ }
49
+ /**
50
+ * Check if this session has exited with an error
51
+ */
52
+ hasExitedWithError() {
53
+ return this.exitCode !== null && this.exitCode !== 0;
54
+ }
55
+ /**
56
+ * Format an error message for posting to Linear
57
+ */
58
+ formatErrorMessage() {
59
+ let errorMessage = `Claude process for issue ${this.issue.identifier} exited unexpectedly with code ${this.exitCode}.`;
60
+ if (this.stderrContent) {
61
+ errorMessage += `\n\n**Error details (stderr):**\n\`\`\`\n${this.stderrContent.substring(0, 1500)} ${this.stderrContent.length > 1500 ? '... (truncated)' : ''}\n\`\`\``;
62
+ }
63
+ return errorMessage;
64
+ }
65
+ /**
66
+ * Add a tool call to the narrative
67
+ */
68
+ addToolCall(toolName) {
69
+ this.streamingNarrative.push({
70
+ type: 'tool_call',
71
+ tool: toolName,
72
+ timestamp: Date.now()
73
+ });
74
+ this.updateStreamingSynthesis();
75
+ }
76
+ /**
77
+ * Add a text snippet to the narrative
78
+ */
79
+ addTextSnippet(text) {
80
+ this.streamingNarrative.push({
81
+ type: 'text',
82
+ content: text,
83
+ timestamp: Date.now()
84
+ });
85
+ this.updateStreamingSynthesis();
86
+ }
87
+ /**
88
+ * Extract a short preview from text content
89
+ */
90
+ extractTextPreview(text) {
91
+ if (!text || typeof text !== 'string')
92
+ return '';
93
+ // Remove extra whitespace and newlines
94
+ const cleaned = text.replace(/\s+/g, ' ').trim();
95
+ // Return first meaningful sentence or truncate at reasonable length
96
+ const firstSentence = cleaned.match(/^[^.!?]*[.!?]/);
97
+ if (firstSentence && firstSentence[0].length <= 100) {
98
+ return firstSentence[0];
99
+ }
100
+ // Truncate to reasonable length
101
+ return cleaned.length > 80 ? cleaned.substring(0, 77) + '...' : cleaned;
102
+ }
103
+ /**
104
+ * Update the streaming synthesis based on chronological narrative
105
+ */
106
+ updateStreamingSynthesis() {
107
+ const entries = [];
108
+ // Process all narrative items chronologically
109
+ let i = 0;
110
+ while (i < this.streamingNarrative.length) {
111
+ const item = this.streamingNarrative[i];
112
+ if (!item) {
113
+ i++;
114
+ continue;
115
+ }
116
+ if (item.type === 'text' && item.content) {
117
+ // Extract preview and add as entry
118
+ const preview = this.extractTextPreview(item.content);
119
+ if (preview) {
120
+ entries.push(preview);
121
+ }
122
+ i++;
123
+ }
124
+ else if (item.type === 'tool_call') {
125
+ // Collect all consecutive tool calls
126
+ const consecutiveTools = [];
127
+ let j = i;
128
+ while (j < this.streamingNarrative.length) {
129
+ const narrativeItem = this.streamingNarrative[j];
130
+ if (!narrativeItem || narrativeItem.type !== 'tool_call') {
131
+ break;
132
+ }
133
+ const toolName = narrativeItem.tool;
134
+ if (toolName && !consecutiveTools.includes(toolName)) {
135
+ consecutiveTools.push(toolName);
136
+ }
137
+ j++;
138
+ }
139
+ // Add grouped tool call summary
140
+ const toolCount = consecutiveTools.length;
141
+ const toolList = consecutiveTools.join(', ');
142
+ entries.push(`${toolCount} tool call${toolCount > 1 ? 's' : ''}: ${toolList}`);
143
+ // Move index to the next non-tool-call item
144
+ i = j;
145
+ }
146
+ else {
147
+ i++;
148
+ }
149
+ }
150
+ // Build chronological synthesis showing all entries
151
+ const synthesis = ['Getting to work...'];
152
+ // Add all entries (don't truncate to show complete chronology)
153
+ for (const entry of entries) {
154
+ synthesis.push(entry);
155
+ }
156
+ this.streamingSynthesis = synthesis.join('\n\n');
157
+ }
158
+ /**
159
+ * Reset streaming state for a new run
160
+ */
161
+ resetStreamingState() {
162
+ this.streamingNarrative = [];
163
+ this.streamingSynthesis = 'Getting to work...';
164
+ }
165
+ }
166
+ //# sourceMappingURL=Session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Session.js","sourceRoot":"","sources":["../src/Session.ts"],"names":[],"mappings":"AAyCA;;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;I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,SAAS,GAAG,CAAC,oBAAoB,CAAC,CAAA;QAExC,+DAA+D;QAC/D,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACvB,CAAC;QAED,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"}
@@ -0,0 +1,41 @@
1
+ import { Session } from './Session.js';
2
+ /**
3
+ * Manages active Claude sessions
4
+ */
5
+ export declare class SessionManager {
6
+ private sessions;
7
+ constructor();
8
+ /**
9
+ * Add a session
10
+ */
11
+ addSession(issueId: string, session: Session): void;
12
+ /**
13
+ * Get a session
14
+ */
15
+ getSession(issueId: string): Session | undefined;
16
+ /**
17
+ * Check if a session exists
18
+ */
19
+ hasSession(issueId: string): boolean;
20
+ /**
21
+ * Remove a session
22
+ */
23
+ removeSession(issueId: string): boolean;
24
+ /**
25
+ * Get all sessions
26
+ */
27
+ getAllSessions(): Map<string, Session>;
28
+ /**
29
+ * Update a session
30
+ */
31
+ updateSession(issueId: string, session: Session): boolean;
32
+ /**
33
+ * Get all active sessions
34
+ */
35
+ getActiveSessions(): Array<[string, Session]>;
36
+ /**
37
+ * Count active sessions
38
+ */
39
+ countActiveSessions(): number;
40
+ }
41
+ //# sourceMappingURL=SessionManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SessionManager.d.ts","sourceRoot":"","sources":["../src/SessionManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAsB;;IAMtC;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAInD;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAIhD;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAIpC;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAIvC;;OAEG;IACH,cAAc,IAAI,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAItC;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO;IASzD;;OAEG;IACH,iBAAiB,IAAI,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAI7C;;OAEG;IACH,mBAAmB,IAAI,MAAM;CAG9B"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Manages active Claude sessions
3
+ */
4
+ export class SessionManager {
5
+ sessions;
6
+ constructor() {
7
+ this.sessions = new Map();
8
+ }
9
+ /**
10
+ * Add a session
11
+ */
12
+ addSession(issueId, session) {
13
+ this.sessions.set(issueId, session);
14
+ }
15
+ /**
16
+ * Get a session
17
+ */
18
+ getSession(issueId) {
19
+ return this.sessions.get(issueId);
20
+ }
21
+ /**
22
+ * Check if a session exists
23
+ */
24
+ hasSession(issueId) {
25
+ return this.sessions.has(issueId);
26
+ }
27
+ /**
28
+ * Remove a session
29
+ */
30
+ removeSession(issueId) {
31
+ return this.sessions.delete(issueId);
32
+ }
33
+ /**
34
+ * Get all sessions
35
+ */
36
+ getAllSessions() {
37
+ return this.sessions;
38
+ }
39
+ /**
40
+ * Update a session
41
+ */
42
+ updateSession(issueId, session) {
43
+ if (!this.sessions.has(issueId)) {
44
+ return false;
45
+ }
46
+ this.sessions.set(issueId, session);
47
+ return true;
48
+ }
49
+ /**
50
+ * Get all active sessions
51
+ */
52
+ getActiveSessions() {
53
+ return Array.from(this.sessions.entries()).filter(([_, session]) => session.isActive());
54
+ }
55
+ /**
56
+ * Count active sessions
57
+ */
58
+ countActiveSessions() {
59
+ return this.getActiveSessions().length;
60
+ }
61
+ }
62
+ //# sourceMappingURL=SessionManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SessionManager.js","sourceRoot":"","sources":["../src/SessionManager.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,cAAc;IACjB,QAAQ,CAAsB;IAEtC;QACE,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAA;IAC3B,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,OAAe,EAAE,OAAgB;QAC1C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACrC,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,OAAe;QACxB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IACnC,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,OAAe;QACxB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IACnC,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,OAAe;QAC3B,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACtC,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,OAAe,EAAE,OAAgB;QAC7C,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YAChC,OAAO,KAAK,CAAA;QACd,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACnC,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;OAEG;IACH,iBAAiB;QACf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA;IACzF,CAAC;IAED;;OAEG;IACH,mBAAmB;QACjB,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC,MAAM,CAAA;IACxC,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ export { Session } from './Session.js';
2
+ export type { SessionOptions, Issue, Workspace, NarrativeItem } from './Session.js';
3
+ export { SessionManager } from './SessionManager.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { Session } from './Session.js';
2
+ export { SessionManager } from './SessionManager.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA"}
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "cyrus-core",
3
+ "version": "0.0.1",
4
+ "description": "Core business logic for Cyrus",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "dependencies": {},
12
+ "devDependencies": {
13
+ "@types/node": "^20.0.0",
14
+ "typescript": "^5.3.3",
15
+ "vitest": "^1.1.0"
16
+ },
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "scripts": {
21
+ "build": "tsc",
22
+ "dev": "tsc --watch",
23
+ "test": "vitest",
24
+ "test:run": "vitest run",
25
+ "typecheck": "tsc --noEmit"
26
+ }
27
+ }