cyrus-core 0.0.6 → 0.0.7
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 +21 -22
- package/dist/PersistenceManager.js.map +1 -1
- package/dist/index.d.ts +4 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/webhook-types.d.ts +85 -1
- package/dist/webhook-types.d.ts.map +1 -1
- package/dist/webhook-types.js +6 -0
- 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
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Session types for Linear Agent Sessions integration
|
|
3
|
+
* These types represent the core data structures for tracking Claude Code sessions in Linear
|
|
4
|
+
*/
|
|
5
|
+
import { LinearDocument } from "@linear/sdk";
|
|
6
|
+
import { ClaudeRunner } from "cyrus-claude-runner";
|
|
7
|
+
export interface IssueMinimal {
|
|
8
|
+
id: string;
|
|
9
|
+
identifier: string;
|
|
10
|
+
title: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
branchName: string;
|
|
13
|
+
}
|
|
14
|
+
export interface Workspace {
|
|
15
|
+
path: string;
|
|
16
|
+
isGitWorktree: boolean;
|
|
17
|
+
historyPath?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface CyrusAgentSession {
|
|
20
|
+
linearAgentActivitySessionId: string;
|
|
21
|
+
type: LinearDocument.AgentSessionType.CommentThread;
|
|
22
|
+
status: LinearDocument.AgentSessionStatus;
|
|
23
|
+
context: LinearDocument.AgentSessionType.CommentThread;
|
|
24
|
+
createdAt: number;
|
|
25
|
+
updatedAt: number;
|
|
26
|
+
issueId: string;
|
|
27
|
+
issue: IssueMinimal;
|
|
28
|
+
workspace: Workspace;
|
|
29
|
+
claudeSessionId?: string;
|
|
30
|
+
claudeRunner?: ClaudeRunner;
|
|
31
|
+
metadata?: {
|
|
32
|
+
model?: string;
|
|
33
|
+
tools?: string[];
|
|
34
|
+
permissionMode?: string;
|
|
35
|
+
apiKeySource?: string;
|
|
36
|
+
totalCostUsd?: number;
|
|
37
|
+
usage?: any;
|
|
38
|
+
commentId?: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface CyrusAgentSessionEntry {
|
|
42
|
+
claudeSessionId: string;
|
|
43
|
+
linearAgentActivityId?: string;
|
|
44
|
+
type: 'user' | 'assistant' | 'system' | 'result';
|
|
45
|
+
content: string;
|
|
46
|
+
metadata?: {
|
|
47
|
+
toolUseId?: string;
|
|
48
|
+
toolName?: string;
|
|
49
|
+
toolInput?: any;
|
|
50
|
+
parentToolUseId?: string;
|
|
51
|
+
timestamp: number;
|
|
52
|
+
durationMs?: number;
|
|
53
|
+
isError?: boolean;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=CyrusAgentSession.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CyrusAgentSession.d.ts","sourceRoot":"","sources":["../src/CyrusAgentSession.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA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MAAM,CAAA;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,SAAS,CAAC,EAAE,GAAG,CAAA;QACf,eAAe,CAAC,EAAE,MAAM,CAAA;QACxB,SAAS,EAAE,MAAM,CAAA;QACjB,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,OAAO,CAAC,EAAE,OAAO,CAAA;KAClB,CAAA;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CyrusAgentSession.js","sourceRoot":"","sources":["../src/CyrusAgentSession.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -1,36 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export interface SerializableSession {
|
|
5
|
-
issueId: string;
|
|
6
|
-
issueIdentifier: string;
|
|
7
|
-
issueTitle: string;
|
|
8
|
-
branchName: string;
|
|
9
|
-
workspacePath: string;
|
|
10
|
-
isGitWorktree: boolean;
|
|
11
|
-
historyPath?: string;
|
|
12
|
-
claudeSessionId: string | null;
|
|
13
|
-
agentRootCommentId: string | null;
|
|
14
|
-
lastCommentId: string | null;
|
|
15
|
-
currentParentId: string | null;
|
|
16
|
-
startedAt: string;
|
|
17
|
-
exitedAt: string | null;
|
|
18
|
-
conversationContext: any;
|
|
19
|
-
}
|
|
1
|
+
import type { CyrusAgentSession, CyrusAgentSessionEntry } from './CyrusAgentSession.js';
|
|
2
|
+
export type SerializedCyrusAgentSession = CyrusAgentSession;
|
|
3
|
+
export type SerializedCyrusAgentSessionEntry = CyrusAgentSessionEntry;
|
|
20
4
|
/**
|
|
21
5
|
* Serializable EdgeWorker state for persistence
|
|
22
6
|
*/
|
|
23
7
|
export interface SerializableEdgeWorkerState {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
commentToLatestAgentReply: Record<string, string>;
|
|
27
|
-
issueToCommentThreads: Record<string, string[]>;
|
|
28
|
-
issueToReplyContext: Record<string, {
|
|
29
|
-
commentId: string;
|
|
30
|
-
parentId?: string;
|
|
31
|
-
}>;
|
|
32
|
-
sessionsByCommentId: Record<string, SerializableSession>;
|
|
33
|
-
sessionsByIssueId: Record<string, SerializableSession[]>;
|
|
8
|
+
agentSessions?: Record<string, Record<string, SerializedCyrusAgentSession>>;
|
|
9
|
+
agentSessionEntries?: Record<string, Record<string, SerializedCyrusAgentSessionEntry[]>>;
|
|
34
10
|
}
|
|
35
11
|
/**
|
|
36
12
|
* Manages persistence of critical mappings to survive restarts
|
|
@@ -39,29 +15,29 @@ export declare class PersistenceManager {
|
|
|
39
15
|
private persistencePath;
|
|
40
16
|
constructor(persistencePath?: string);
|
|
41
17
|
/**
|
|
42
|
-
* Get the full path to the state file
|
|
18
|
+
* Get the full path to the single EdgeWorker state file
|
|
43
19
|
*/
|
|
44
|
-
private
|
|
20
|
+
private getEdgeWorkerStateFilePath;
|
|
45
21
|
/**
|
|
46
22
|
* Ensure the persistence directory exists
|
|
47
23
|
*/
|
|
48
24
|
private ensurePersistenceDirectory;
|
|
49
25
|
/**
|
|
50
|
-
* Save EdgeWorker state to disk
|
|
26
|
+
* Save EdgeWorker state to disk (single file for all repositories)
|
|
51
27
|
*/
|
|
52
|
-
saveEdgeWorkerState(
|
|
28
|
+
saveEdgeWorkerState(state: SerializableEdgeWorkerState): Promise<void>;
|
|
53
29
|
/**
|
|
54
|
-
* Load EdgeWorker state from disk
|
|
30
|
+
* Load EdgeWorker state from disk (single file for all repositories)
|
|
55
31
|
*/
|
|
56
|
-
loadEdgeWorkerState(
|
|
32
|
+
loadEdgeWorkerState(): Promise<SerializableEdgeWorkerState | null>;
|
|
57
33
|
/**
|
|
58
|
-
* Check if state file exists
|
|
34
|
+
* Check if EdgeWorker state file exists
|
|
59
35
|
*/
|
|
60
|
-
hasStateFile(
|
|
36
|
+
hasStateFile(): boolean;
|
|
61
37
|
/**
|
|
62
|
-
* Delete state file
|
|
38
|
+
* Delete EdgeWorker state file
|
|
63
39
|
*/
|
|
64
|
-
deleteStateFile(
|
|
40
|
+
deleteStateFile(): Promise<void>;
|
|
65
41
|
/**
|
|
66
42
|
* Convert Map to Record for serialization
|
|
67
43
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersistenceManager.d.ts","sourceRoot":"","sources":["../src/PersistenceManager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PersistenceManager.d.ts","sourceRoot":"","sources":["../src/PersistenceManager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAG,MAAM,wBAAwB,CAAA;AAIxF,MAAM,MAAM,2BAA2B,GAAG,iBAAiB,CAAA;AAM3D,MAAM,MAAM,gCAAgC,GAAG,sBAAsB,CAAA;AAOrE;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAE1C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC,CAAA;IAC3E,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,gCAAgC,EAAE,CAAC,CAAC,CAAA;CACzF;AAED;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,eAAe,CAAQ;gBAEnB,eAAe,CAAC,EAAE,MAAM;IAIpC;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAIlC;;OAEG;YACW,0BAA0B;IAIxC;;OAEG;IACG,mBAAmB,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB5E;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,2BAA2B,GAAG,IAAI,CAAC;IAsBxE;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAWtC;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAI7D;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IAIhE;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;IAItC;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;CAGzC"}
|
|
@@ -11,10 +11,10 @@ export class PersistenceManager {
|
|
|
11
11
|
this.persistencePath = persistencePath || join(homedir(), '.cyrus', 'state');
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* Get the full path to the state file
|
|
14
|
+
* Get the full path to the single EdgeWorker state file
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
return join(this.persistencePath,
|
|
16
|
+
getEdgeWorkerStateFilePath() {
|
|
17
|
+
return join(this.persistencePath, 'edge-worker-state.json');
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Ensure the persistence directory exists
|
|
@@ -23,65 +23,64 @@ export class PersistenceManager {
|
|
|
23
23
|
await mkdir(this.persistencePath, { recursive: true });
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* Save EdgeWorker state to disk
|
|
26
|
+
* Save EdgeWorker state to disk (single file for all repositories)
|
|
27
27
|
*/
|
|
28
|
-
async saveEdgeWorkerState(
|
|
28
|
+
async saveEdgeWorkerState(state) {
|
|
29
29
|
try {
|
|
30
30
|
await this.ensurePersistenceDirectory();
|
|
31
|
-
const stateFile = this.
|
|
31
|
+
const stateFile = this.getEdgeWorkerStateFilePath();
|
|
32
32
|
const stateData = {
|
|
33
|
-
version: '
|
|
33
|
+
version: '2.0',
|
|
34
34
|
savedAt: new Date().toISOString(),
|
|
35
|
-
repositoryId,
|
|
36
35
|
state
|
|
37
36
|
};
|
|
38
37
|
await writeFile(stateFile, JSON.stringify(stateData, null, 2), 'utf8');
|
|
39
38
|
}
|
|
40
39
|
catch (error) {
|
|
41
|
-
console.error(`Failed to save EdgeWorker state
|
|
40
|
+
console.error(`Failed to save EdgeWorker state:`, error);
|
|
42
41
|
throw error;
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
/**
|
|
46
|
-
* Load EdgeWorker state from disk
|
|
45
|
+
* Load EdgeWorker state from disk (single file for all repositories)
|
|
47
46
|
*/
|
|
48
|
-
async loadEdgeWorkerState(
|
|
47
|
+
async loadEdgeWorkerState() {
|
|
49
48
|
try {
|
|
50
|
-
const stateFile = this.
|
|
49
|
+
const stateFile = this.getEdgeWorkerStateFilePath();
|
|
51
50
|
if (!existsSync(stateFile)) {
|
|
52
51
|
return null;
|
|
53
52
|
}
|
|
54
53
|
const stateData = JSON.parse(await readFile(stateFile, 'utf8'));
|
|
55
54
|
// Validate state structure
|
|
56
|
-
if (!stateData.state ||
|
|
57
|
-
console.warn(`Invalid state file
|
|
55
|
+
if (!stateData.state || stateData.version !== '2.0') {
|
|
56
|
+
console.warn(`Invalid or outdated state file, ignoring`);
|
|
58
57
|
return null;
|
|
59
58
|
}
|
|
60
59
|
return stateData.state;
|
|
61
60
|
}
|
|
62
61
|
catch (error) {
|
|
63
|
-
console.error(`Failed to load EdgeWorker state
|
|
62
|
+
console.error(`Failed to load EdgeWorker state:`, error);
|
|
64
63
|
return null;
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
66
|
/**
|
|
68
|
-
* Check if state file exists
|
|
67
|
+
* Check if EdgeWorker state file exists
|
|
69
68
|
*/
|
|
70
|
-
hasStateFile(
|
|
71
|
-
return existsSync(this.
|
|
69
|
+
hasStateFile() {
|
|
70
|
+
return existsSync(this.getEdgeWorkerStateFilePath());
|
|
72
71
|
}
|
|
73
72
|
/**
|
|
74
|
-
* Delete state file
|
|
73
|
+
* Delete EdgeWorker state file
|
|
75
74
|
*/
|
|
76
|
-
async deleteStateFile(
|
|
75
|
+
async deleteStateFile() {
|
|
77
76
|
try {
|
|
78
|
-
const stateFile = this.
|
|
77
|
+
const stateFile = this.getEdgeWorkerStateFilePath();
|
|
79
78
|
if (existsSync(stateFile)) {
|
|
80
79
|
await writeFile(stateFile, '', 'utf8'); // Clear file instead of deleting
|
|
81
80
|
}
|
|
82
81
|
}
|
|
83
82
|
catch (error) {
|
|
84
|
-
console.error(`Failed to delete state file
|
|
83
|
+
console.error(`Failed to delete EdgeWorker state file:`, error);
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
86
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersistenceManager.js","sourceRoot":"","sources":["../src/PersistenceManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"PersistenceManager.js","sourceRoot":"","sources":["../src/PersistenceManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AA2B/B;;GAEG;AACH,MAAM,OAAO,kBAAkB;IACrB,eAAe,CAAQ;IAE/B,YAAY,eAAwB;QAClC,IAAI,CAAC,eAAe,GAAG,eAAe,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA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vB,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
export { Session } from './Session.js';
|
|
2
|
-
export type { SessionOptions, Issue, Workspace, NarrativeItem } from './Session.js';
|
|
3
|
-
export { SessionManager } from './SessionManager.js';
|
|
4
1
|
export { PersistenceManager } from './PersistenceManager.js';
|
|
5
|
-
export type {
|
|
6
|
-
export type {
|
|
7
|
-
export {
|
|
2
|
+
export type { SerializedCyrusAgentSession, SerializedCyrusAgentSessionEntry, SerializableEdgeWorkerState } from './PersistenceManager.js';
|
|
3
|
+
export type { CyrusAgentSession, CyrusAgentSessionEntry, IssueMinimal, Workspace } from './CyrusAgentSession.js';
|
|
4
|
+
export type { LinearWebhookTeam, LinearWebhookIssue, LinearWebhookComment, LinearWebhookActor, LinearWebhookNotification, LinearIssueAssignedNotification, LinearIssueCommentMentionNotification, LinearIssueNewCommentNotification, LinearIssueUnassignedNotification, LinearWebhookCreator, LinearWebhookAgentSession, LinearWebhookAgentActivity, LinearWebhookAgentActivityContent, LinearWebhook, LinearIssueAssignedWebhook, LinearIssueCommentMentionWebhook, LinearIssueNewCommentWebhook, LinearIssueUnassignedWebhook, LinearAgentSessionCreatedWebhook, LinearAgentSessionPromptedWebhook } from './webhook-types.js';
|
|
5
|
+
export { isIssueAssignedWebhook, isIssueCommentMentionWebhook, isIssueNewCommentWebhook, isIssueUnassignedWebhook, isAgentSessionCreatedWebhook, isAgentSessionPromptedWebhook } from './webhook-types.js';
|
|
8
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,YAAY,EAAE,2BAA2B,EAAE,gCAAgC,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAA;AACzI,YAAY,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAGhH,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,yBAAyB,EACzB,+BAA+B,EAC/B,qCAAqC,EACrC,iCAAiC,EACjC,iCAAiC,EACjC,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,EAC1B,iCAAiC,EACjC,aAAa,EACb,0BAA0B,EAC1B,gCAAgC,EAChC,4BAA4B,EAC5B,4BAA4B,EAC5B,gCAAgC,EAChC,iCAAiC,EAClC,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,EAC9B,MAAM,oBAAoB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { Session } from './Session.js'
|
|
2
|
-
export {
|
|
1
|
+
// export { Session } from './Session.js'
|
|
2
|
+
// export type { SessionOptions, , NarrativeItem } from './Session.js'
|
|
3
|
+
// export { ClaudeSessionManager as SessionManager } from './ClaudeSessionManager.js'
|
|
3
4
|
export { PersistenceManager } from './PersistenceManager.js';
|
|
4
|
-
export { isIssueAssignedWebhook, isIssueCommentMentionWebhook, isIssueNewCommentWebhook, isIssueUnassignedWebhook } from './webhook-types.js';
|
|
5
|
+
export { isIssueAssignedWebhook, isIssueCommentMentionWebhook, isIssueNewCommentWebhook, isIssueUnassignedWebhook, isAgentSessionCreatedWebhook, isAgentSessionPromptedWebhook } from './webhook-types.js';
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,sEAAsE;AACtE,qFAAqF;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AA4B5D,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,EAC9B,MAAM,oBAAoB,CAAA"}
|
package/dist/webhook-types.d.ts
CHANGED
|
@@ -150,10 +150,92 @@ export interface LinearIssueUnassignedWebhook {
|
|
|
150
150
|
webhookTimestamp: number;
|
|
151
151
|
webhookId: string;
|
|
152
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Creator data in agent session webhooks
|
|
155
|
+
*/
|
|
156
|
+
export interface LinearWebhookCreator {
|
|
157
|
+
id: string;
|
|
158
|
+
name: string;
|
|
159
|
+
email: string;
|
|
160
|
+
avatarUrl: string;
|
|
161
|
+
url: string;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Agent Session data from webhooks
|
|
165
|
+
*/
|
|
166
|
+
export interface LinearWebhookAgentSession {
|
|
167
|
+
id: string;
|
|
168
|
+
createdAt: string;
|
|
169
|
+
updatedAt: string;
|
|
170
|
+
archivedAt: string | null;
|
|
171
|
+
creatorId: string;
|
|
172
|
+
appUserId: string;
|
|
173
|
+
commentId: string;
|
|
174
|
+
issueId: string;
|
|
175
|
+
status: 'pending' | 'active' | 'error' | 'awaiting-input' | 'complete';
|
|
176
|
+
startedAt: string | null;
|
|
177
|
+
endedAt: string | null;
|
|
178
|
+
type: 'commentThread';
|
|
179
|
+
summary: string | null;
|
|
180
|
+
sourceMetadata: any | null;
|
|
181
|
+
organizationId: string;
|
|
182
|
+
creator: LinearWebhookCreator;
|
|
183
|
+
comment: LinearWebhookComment;
|
|
184
|
+
issue: LinearWebhookIssue;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Agent Activity content types
|
|
188
|
+
*/
|
|
189
|
+
export interface LinearWebhookAgentActivityContent {
|
|
190
|
+
type: 'prompt' | 'observation' | 'action' | 'error' | 'elicitation' | 'response';
|
|
191
|
+
body: string;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Agent Activity data from webhooks
|
|
195
|
+
*/
|
|
196
|
+
export interface LinearWebhookAgentActivity {
|
|
197
|
+
id: string;
|
|
198
|
+
createdAt: string;
|
|
199
|
+
updatedAt: string;
|
|
200
|
+
archivedAt: string | null;
|
|
201
|
+
agentContextId: string | null;
|
|
202
|
+
agentSessionId: string;
|
|
203
|
+
sourceCommentId: string;
|
|
204
|
+
content: LinearWebhookAgentActivityContent;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Agent Session created webhook payload
|
|
208
|
+
*/
|
|
209
|
+
export interface LinearAgentSessionCreatedWebhook {
|
|
210
|
+
type: 'AgentSessionEvent';
|
|
211
|
+
action: 'created';
|
|
212
|
+
createdAt: string;
|
|
213
|
+
organizationId: string;
|
|
214
|
+
oauthClientId: string;
|
|
215
|
+
appUserId: string;
|
|
216
|
+
agentSession: LinearWebhookAgentSession;
|
|
217
|
+
webhookTimestamp: string;
|
|
218
|
+
webhookId: string;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Agent Session prompted webhook payload
|
|
222
|
+
*/
|
|
223
|
+
export interface LinearAgentSessionPromptedWebhook {
|
|
224
|
+
type: 'AgentSessionEvent';
|
|
225
|
+
action: 'prompted';
|
|
226
|
+
createdAt: string;
|
|
227
|
+
organizationId: string;
|
|
228
|
+
oauthClientId: string;
|
|
229
|
+
appUserId: string;
|
|
230
|
+
agentSession: LinearWebhookAgentSession;
|
|
231
|
+
agentActivity: LinearWebhookAgentActivity;
|
|
232
|
+
webhookTimestamp: string;
|
|
233
|
+
webhookId: string;
|
|
234
|
+
}
|
|
153
235
|
/**
|
|
154
236
|
* Union of all webhook types we handle
|
|
155
237
|
*/
|
|
156
|
-
export type LinearWebhook = LinearIssueAssignedWebhook | LinearIssueCommentMentionWebhook | LinearIssueNewCommentWebhook | LinearIssueUnassignedWebhook;
|
|
238
|
+
export type LinearWebhook = LinearIssueAssignedWebhook | LinearIssueCommentMentionWebhook | LinearIssueNewCommentWebhook | LinearIssueUnassignedWebhook | LinearAgentSessionCreatedWebhook | LinearAgentSessionPromptedWebhook;
|
|
157
239
|
/**
|
|
158
240
|
* Type guards for webhook discrimination
|
|
159
241
|
*/
|
|
@@ -161,4 +243,6 @@ export declare function isIssueAssignedWebhook(webhook: LinearWebhook): webhook
|
|
|
161
243
|
export declare function isIssueCommentMentionWebhook(webhook: LinearWebhook): webhook is LinearIssueCommentMentionWebhook;
|
|
162
244
|
export declare function isIssueNewCommentWebhook(webhook: LinearWebhook): webhook is LinearIssueNewCommentWebhook;
|
|
163
245
|
export declare function isIssueUnassignedWebhook(webhook: LinearWebhook): webhook is LinearIssueUnassignedWebhook;
|
|
246
|
+
export declare function isAgentSessionCreatedWebhook(webhook: LinearWebhook): webhook is LinearAgentSessionCreatedWebhook;
|
|
247
|
+
export declare function isAgentSessionPromptedWebhook(webhook: LinearWebhook): webhook is LinearAgentSessionPromptedWebhook;
|
|
164
248
|
//# sourceMappingURL=webhook-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook-types.d.ts","sourceRoot":"","sources":["../src/webhook-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,iBAAiB,CAAA;IACvB,UAAU,EAAE,MAA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G;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,IAAI,gCAAgC,CAEhH;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,IAAI,4BAA4B,CAExG;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,IAAI,4BAA4B,CAExG;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,IAAI,gCAAgC,CAEhH;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,IAAI,iCAAiC,CAElH"}
|
package/dist/webhook-types.js
CHANGED
|
@@ -17,4 +17,10 @@ export function isIssueNewCommentWebhook(webhook) {
|
|
|
17
17
|
export function isIssueUnassignedWebhook(webhook) {
|
|
18
18
|
return webhook.action === 'issueUnassignedFromYou';
|
|
19
19
|
}
|
|
20
|
+
export function isAgentSessionCreatedWebhook(webhook) {
|
|
21
|
+
return webhook.type === 'AgentSessionEvent' && webhook.action === 'created';
|
|
22
|
+
}
|
|
23
|
+
export function isAgentSessionPromptedWebhook(webhook) {
|
|
24
|
+
return webhook.type === 'AgentSessionEvent' && webhook.action === 'prompted';
|
|
25
|
+
}
|
|
20
26
|
//# sourceMappingURL=webhook-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook-types.js","sourceRoot":"","sources":["../src/webhook-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"webhook-types.js","sourceRoot":"","sources":["../src/webhook-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2QH;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAsB;IAC3D,OAAO,OAAO,CAAC,MAAM,KAAK,oBAAoB,CAAA;AAChD,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,OAAsB;IACjE,OAAO,OAAO,CAAC,MAAM,KAAK,qBAAqB,CAAA;AACjD,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,OAAsB;IAC7D,OAAO,OAAO,CAAC,MAAM,KAAK,iBAAiB,CAAA;AAC7C,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,OAAsB;IAC7D,OAAO,OAAO,CAAC,MAAM,KAAK,wBAAwB,CAAA;AACpD,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,OAAsB;IACjE,OAAO,OAAO,CAAC,IAAI,KAAK,mBAAmB,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,CAAA;AAC7E,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,OAAsB;IAClE,OAAO,OAAO,CAAC,IAAI,KAAK,mBAAmB,IAAI,OAAO,CAAC,MAAM,KAAK,UAAU,CAAA;AAC9E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cyrus-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Core business logic for Cyrus",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
|
-
"dependencies": {
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@linear/sdk": "^52.0.0",
|
|
13
|
+
"cyrus-claude-runner": "0.0.14"
|
|
14
|
+
},
|
|
12
15
|
"devDependencies": {
|
|
13
16
|
"@types/node": "^20.0.0",
|
|
14
17
|
"typescript": "^5.3.3",
|
|
@@ -21,7 +24,7 @@
|
|
|
21
24
|
"build": "tsc",
|
|
22
25
|
"dev": "tsc --watch",
|
|
23
26
|
"test": "vitest",
|
|
24
|
-
"test:run": "vitest run",
|
|
27
|
+
"test:run": "vitest run --passWithNoTests",
|
|
25
28
|
"typecheck": "tsc --noEmit"
|
|
26
29
|
}
|
|
27
30
|
}
|
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 @@
|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