cyrus-core 0.2.21 → 0.2.22
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/dist/CyrusAgentSession.d.ts +31 -3
- package/dist/CyrusAgentSession.d.ts.map +1 -1
- package/dist/PersistenceManager.d.ts +21 -1
- package/dist/PersistenceManager.d.ts.map +1 -1
- package/dist/PersistenceManager.js +93 -8
- package/dist/PersistenceManager.js.map +1 -1
- package/dist/agent-runner-types.d.ts +15 -0
- package/dist/agent-runner-types.d.ts.map +1 -1
- package/dist/config-schemas.d.ts +20 -8
- package/dist/config-schemas.d.ts.map +1 -1
- package/dist/config-schemas.js +21 -4
- package/dist/config-schemas.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/issue-tracker/IAgentEventTransport.d.ts +19 -1
- package/dist/issue-tracker/IAgentEventTransport.d.ts.map +1 -1
- package/dist/logging/ILogger.d.ts +23 -0
- package/dist/logging/ILogger.d.ts.map +1 -0
- package/dist/logging/ILogger.js +9 -0
- package/dist/logging/ILogger.js.map +1 -0
- package/dist/logging/Logger.d.ts +8 -0
- package/dist/logging/Logger.d.ts.map +1 -0
- package/dist/logging/Logger.js +94 -0
- package/dist/logging/Logger.js.map +1 -0
- package/dist/logging/index.d.ts +4 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +3 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/messages/IMessageTranslator.d.ts +71 -0
- package/dist/messages/IMessageTranslator.d.ts.map +1 -0
- package/dist/messages/IMessageTranslator.js +10 -0
- package/dist/messages/IMessageTranslator.js.map +1 -0
- package/dist/messages/index.d.ts +14 -0
- package/dist/messages/index.d.ts.map +1 -0
- package/dist/messages/index.js +12 -0
- package/dist/messages/index.js.map +1 -0
- package/dist/messages/platform-refs.d.ts +228 -0
- package/dist/messages/platform-refs.d.ts.map +1 -0
- package/dist/messages/platform-refs.js +11 -0
- package/dist/messages/platform-refs.js.map +1 -0
- package/dist/messages/type-guards.d.ts +78 -0
- package/dist/messages/type-guards.d.ts.map +1 -0
- package/dist/messages/type-guards.js +102 -0
- package/dist/messages/type-guards.js.map +1 -0
- package/dist/messages/types.d.ts +256 -0
- package/dist/messages/types.d.ts.map +1 -0
- package/dist/messages/types.js +11 -0
- package/dist/messages/types.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare enum LogLevel {
|
|
2
|
+
DEBUG = 0,
|
|
3
|
+
INFO = 1,
|
|
4
|
+
WARN = 2,
|
|
5
|
+
ERROR = 3,
|
|
6
|
+
SILENT = 4
|
|
7
|
+
}
|
|
8
|
+
export interface LogContext {
|
|
9
|
+
sessionId?: string;
|
|
10
|
+
platform?: string;
|
|
11
|
+
issueIdentifier?: string;
|
|
12
|
+
repository?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ILogger {
|
|
15
|
+
debug(message: string, ...args: unknown[]): void;
|
|
16
|
+
info(message: string, ...args: unknown[]): void;
|
|
17
|
+
warn(message: string, ...args: unknown[]): void;
|
|
18
|
+
error(message: string, ...args: unknown[]): void;
|
|
19
|
+
withContext(context: LogContext): ILogger;
|
|
20
|
+
getLevel(): LogLevel;
|
|
21
|
+
setLevel(level: LogLevel): void;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=ILogger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILogger.d.ts","sourceRoot":"","sources":["../../src/logging/ILogger.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IACnB,KAAK,IAAI;IACT,IAAI,IAAI;IACR,IAAI,IAAI;IACR,KAAK,IAAI;IACT,MAAM,IAAI;CACV;AAED,MAAM,WAAW,UAAU;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,OAAO;IACvB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACjD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACjD,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC;IAC1C,QAAQ,IAAI,QAAQ,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;CAChC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var LogLevel;
|
|
2
|
+
(function (LogLevel) {
|
|
3
|
+
LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
|
|
4
|
+
LogLevel[LogLevel["INFO"] = 1] = "INFO";
|
|
5
|
+
LogLevel[LogLevel["WARN"] = 2] = "WARN";
|
|
6
|
+
LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
|
|
7
|
+
LogLevel[LogLevel["SILENT"] = 4] = "SILENT";
|
|
8
|
+
})(LogLevel || (LogLevel = {}));
|
|
9
|
+
//# sourceMappingURL=ILogger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILogger.js","sourceRoot":"","sources":["../../src/logging/ILogger.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,QAMX;AAND,WAAY,QAAQ;IACnB,yCAAS,CAAA;IACT,uCAAQ,CAAA;IACR,uCAAQ,CAAA;IACR,yCAAS,CAAA;IACT,2CAAU,CAAA;AACX,CAAC,EANW,QAAQ,KAAR,QAAQ,QAMnB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ILogger, LogContext } from "./ILogger.js";
|
|
2
|
+
import { LogLevel } from "./ILogger.js";
|
|
3
|
+
export declare function createLogger(options: {
|
|
4
|
+
component: string;
|
|
5
|
+
level?: LogLevel;
|
|
6
|
+
context?: LogContext;
|
|
7
|
+
}): ILogger;
|
|
8
|
+
//# sourceMappingURL=Logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../src/logging/Logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AA4GxC,wBAAgB,YAAY,CAAC,OAAO,EAAE;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,OAAO,CAAC,EAAE,UAAU,CAAC;CACrB,GAAG,OAAO,CAEV"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { LogLevel } from "./ILogger.js";
|
|
2
|
+
function formatContext(context) {
|
|
3
|
+
const parts = [];
|
|
4
|
+
if (context.sessionId) {
|
|
5
|
+
parts.push(`session=${context.sessionId.slice(0, 8)}`);
|
|
6
|
+
}
|
|
7
|
+
if (context.platform) {
|
|
8
|
+
parts.push(`platform=${context.platform}`);
|
|
9
|
+
}
|
|
10
|
+
if (context.issueIdentifier) {
|
|
11
|
+
parts.push(`issue=${context.issueIdentifier}`);
|
|
12
|
+
}
|
|
13
|
+
if (context.repository) {
|
|
14
|
+
parts.push(`repo=${context.repository}`);
|
|
15
|
+
}
|
|
16
|
+
return parts.length > 0 ? ` {${parts.join(", ")}}` : "";
|
|
17
|
+
}
|
|
18
|
+
function parseLevelFromEnv() {
|
|
19
|
+
const envLevel = process.env.CYRUS_LOG_LEVEL?.toUpperCase();
|
|
20
|
+
switch (envLevel) {
|
|
21
|
+
case "DEBUG":
|
|
22
|
+
return LogLevel.DEBUG;
|
|
23
|
+
case "INFO":
|
|
24
|
+
return LogLevel.INFO;
|
|
25
|
+
case "WARN":
|
|
26
|
+
return LogLevel.WARN;
|
|
27
|
+
case "ERROR":
|
|
28
|
+
return LogLevel.ERROR;
|
|
29
|
+
case "SILENT":
|
|
30
|
+
return LogLevel.SILENT;
|
|
31
|
+
default:
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const LEVEL_LABELS = {
|
|
36
|
+
[LogLevel.DEBUG]: "DEBUG",
|
|
37
|
+
[LogLevel.INFO]: "INFO",
|
|
38
|
+
[LogLevel.WARN]: "WARN",
|
|
39
|
+
[LogLevel.ERROR]: "ERROR",
|
|
40
|
+
[LogLevel.SILENT]: "",
|
|
41
|
+
};
|
|
42
|
+
class Logger {
|
|
43
|
+
level;
|
|
44
|
+
component;
|
|
45
|
+
context;
|
|
46
|
+
constructor(options) {
|
|
47
|
+
this.component = options.component;
|
|
48
|
+
this.level = options.level ?? parseLevelFromEnv() ?? LogLevel.INFO;
|
|
49
|
+
this.context = options.context ?? {};
|
|
50
|
+
}
|
|
51
|
+
formatPrefix(level) {
|
|
52
|
+
const label = LEVEL_LABELS[level];
|
|
53
|
+
const padded = label.padEnd(5);
|
|
54
|
+
const ctx = formatContext(this.context);
|
|
55
|
+
return `[${padded}] [${this.component}]${ctx}`;
|
|
56
|
+
}
|
|
57
|
+
debug(message, ...args) {
|
|
58
|
+
if (this.level <= LogLevel.DEBUG) {
|
|
59
|
+
console.log(`${this.formatPrefix(LogLevel.DEBUG)} ${message}`, ...args);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
info(message, ...args) {
|
|
63
|
+
if (this.level <= LogLevel.INFO) {
|
|
64
|
+
console.log(`${this.formatPrefix(LogLevel.INFO)} ${message}`, ...args);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
warn(message, ...args) {
|
|
68
|
+
if (this.level <= LogLevel.WARN) {
|
|
69
|
+
console.warn(`${this.formatPrefix(LogLevel.WARN)} ${message}`, ...args);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
error(message, ...args) {
|
|
73
|
+
if (this.level <= LogLevel.ERROR) {
|
|
74
|
+
console.error(`${this.formatPrefix(LogLevel.ERROR)} ${message}`, ...args);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
withContext(context) {
|
|
78
|
+
return new Logger({
|
|
79
|
+
component: this.component,
|
|
80
|
+
level: this.level,
|
|
81
|
+
context: { ...this.context, ...context },
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
getLevel() {
|
|
85
|
+
return this.level;
|
|
86
|
+
}
|
|
87
|
+
setLevel(level) {
|
|
88
|
+
this.level = level;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export function createLogger(options) {
|
|
92
|
+
return new Logger(options);
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=Logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../src/logging/Logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,SAAS,aAAa,CAAC,OAAmB;IACzC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CAAC,WAAW,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACxD,CAAC;IACD,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACtB,KAAK,CAAC,IAAI,CAAC,YAAY,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC5C,CAAC;IACD,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;QAC7B,KAAK,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I,CAAC,CAAC;QACzE,CAAC;IACF,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;QACxC,IAAI,IAAI,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;YAClC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;QAC3E,CAAC;IACF,CAAC;IAED,WAAW,CAAC,OAAmB;QAC9B,OAAO,IAAI,MAAM,CAAC;YACjB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE;SACxC,CAAC,CAAC;IACJ,CAAC;IAED,QAAQ;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAED,QAAQ,CAAC,KAAe;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,CAAC;CACD;AAED,MAAM,UAAU,YAAY,CAAC,OAI5B;IACA,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logging/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logging/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message Translator Interface
|
|
3
|
+
*
|
|
4
|
+
* This module defines the interface for translating platform-specific webhook
|
|
5
|
+
* payloads into unified internal messages.
|
|
6
|
+
*
|
|
7
|
+
* @module messages/IMessageTranslator
|
|
8
|
+
*/
|
|
9
|
+
import type { InternalMessage } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Result of a translation attempt.
|
|
12
|
+
* Translation can fail if the webhook is not relevant or malformed.
|
|
13
|
+
*/
|
|
14
|
+
export type TranslationResult = {
|
|
15
|
+
success: true;
|
|
16
|
+
message: InternalMessage;
|
|
17
|
+
} | {
|
|
18
|
+
success: false;
|
|
19
|
+
reason: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Interface for platform-specific message translators.
|
|
23
|
+
*
|
|
24
|
+
* Each platform (Linear, GitHub, Slack) implements this interface to translate
|
|
25
|
+
* their webhook payloads into the unified InternalMessage format.
|
|
26
|
+
*
|
|
27
|
+
* @typeParam TWebhook - The platform-specific webhook payload type
|
|
28
|
+
*/
|
|
29
|
+
export interface IMessageTranslator<TWebhook> {
|
|
30
|
+
/**
|
|
31
|
+
* Translate a platform-specific webhook into an internal message.
|
|
32
|
+
*
|
|
33
|
+
* @param webhook - The platform-specific webhook payload
|
|
34
|
+
* @param context - Optional additional context needed for translation
|
|
35
|
+
* @returns TranslationResult indicating success with the message or failure with reason
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const translator = new LinearMessageTranslator();
|
|
40
|
+
* const result = translator.translate(webhookPayload);
|
|
41
|
+
*
|
|
42
|
+
* if (result.success) {
|
|
43
|
+
* handleMessage(result.message);
|
|
44
|
+
* } else {
|
|
45
|
+
* console.log('Skipped webhook:', result.reason);
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
translate(webhook: TWebhook, context?: TranslationContext): TranslationResult;
|
|
50
|
+
/**
|
|
51
|
+
* Check if this translator can handle the given webhook.
|
|
52
|
+
*
|
|
53
|
+
* @param webhook - The webhook payload to check
|
|
54
|
+
* @returns true if this translator can translate the webhook
|
|
55
|
+
*/
|
|
56
|
+
canTranslate(webhook: unknown): webhook is TWebhook;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Context information that may be needed during translation.
|
|
60
|
+
*/
|
|
61
|
+
export interface TranslationContext {
|
|
62
|
+
/** Organization ID if not in the webhook */
|
|
63
|
+
organizationId?: string;
|
|
64
|
+
/** Linear API token for Linear webhooks */
|
|
65
|
+
linearApiToken?: string;
|
|
66
|
+
/** GitHub installation token for GitHub webhooks */
|
|
67
|
+
installationToken?: string;
|
|
68
|
+
/** Additional metadata */
|
|
69
|
+
metadata?: Record<string, unknown>;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=IMessageTranslator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMessageTranslator.d.ts","sourceRoot":"","sources":["../../src/messages/IMessageTranslator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAC1B;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,eAAe,CAAA;CAAE,GAC3C;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB,CAAC,QAAQ;IAC3C;;;;;;;;;;;;;;;;;;OAkBG;IACH,SAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,iBAAiB,CAAC;IAE9E;;;;;OAKG;IACH,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,QAAQ,CAAC;CACpD;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,4CAA4C;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2CAA2C;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message Translator Interface
|
|
3
|
+
*
|
|
4
|
+
* This module defines the interface for translating platform-specific webhook
|
|
5
|
+
* payloads into unified internal messages.
|
|
6
|
+
*
|
|
7
|
+
* @module messages/IMessageTranslator
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=IMessageTranslator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMessageTranslator.js","sourceRoot":"","sources":["../../src/messages/IMessageTranslator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal Message Bus
|
|
3
|
+
*
|
|
4
|
+
* This module exports all types and utilities for the internal message bus
|
|
5
|
+
* that provides a unified interface for handling events from multiple
|
|
6
|
+
* webhook sources (Linear, GitHub, Slack, etc.).
|
|
7
|
+
*
|
|
8
|
+
* @module messages
|
|
9
|
+
*/
|
|
10
|
+
export type { IMessageTranslator, TranslationContext, TranslationResult, } from "./IMessageTranslator.js";
|
|
11
|
+
export type { GitHubPlatformRef, LinearPlatformRef, SlackPlatformRef, } from "./platform-refs.js";
|
|
12
|
+
export { hasGitHubSessionStartPlatformData, hasGitHubUserPromptPlatformData, hasLinearSessionStartPlatformData, hasLinearUserPromptPlatformData, hasSlackSessionStartPlatformData, hasSlackUserPromptPlatformData, isContentUpdateMessage, isGitHubMessage, isLinearMessage, isSessionStartMessage, isSlackMessage, isStopSignalMessage, isUnassignMessage, isUserPromptMessage, } from "./type-guards.js";
|
|
13
|
+
export type { ContentChanges, ContentUpdateMessage, GitHubSessionStartPlatformData, GitHubUserPromptPlatformData, GuidanceItem, InternalMessage, InternalMessageBase, LinearContentUpdatePlatformData, LinearSessionStartPlatformData, LinearStopSignalPlatformData, LinearUnassignPlatformData, LinearUserPromptPlatformData, MessageAction, MessageAuthor, MessageSource, SessionStartMessage, SlackSessionStartPlatformData, SlackUserPromptPlatformData, StopSignalMessage, UnassignMessage, UserPromptMessage, } from "./types.js";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,YAAY,EACX,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,GACjB,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EACX,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,GAChB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACN,iCAAiC,EACjC,+BAA+B,EAC/B,iCAAiC,EACjC,+BAA+B,EAC/B,gCAAgC,EAChC,8BAA8B,EAC9B,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACX,cAAc,EACd,oBAAoB,EACpB,8BAA8B,EAC9B,4BAA4B,EAC5B,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,+BAA+B,EAE/B,8BAA8B,EAC9B,4BAA4B,EAC5B,0BAA0B,EAC1B,4BAA4B,EAC5B,aAAa,EACb,aAAa,EACb,aAAa,EACb,mBAAmB,EAEnB,6BAA6B,EAC7B,2BAA2B,EAC3B,iBAAiB,EACjB,eAAe,EACf,iBAAiB,GACjB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal Message Bus
|
|
3
|
+
*
|
|
4
|
+
* This module exports all types and utilities for the internal message bus
|
|
5
|
+
* that provides a unified interface for handling events from multiple
|
|
6
|
+
* webhook sources (Linear, GitHub, Slack, etc.).
|
|
7
|
+
*
|
|
8
|
+
* @module messages
|
|
9
|
+
*/
|
|
10
|
+
// Type guards
|
|
11
|
+
export { hasGitHubSessionStartPlatformData, hasGitHubUserPromptPlatformData, hasLinearSessionStartPlatformData, hasLinearUserPromptPlatformData, hasSlackSessionStartPlatformData, hasSlackUserPromptPlatformData, isContentUpdateMessage, isGitHubMessage, isLinearMessage, isSessionStartMessage, isSlackMessage, isStopSignalMessage, isUnassignMessage, isUserPromptMessage, } from "./type-guards.js";
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgBH,cAAc;AACd,OAAO,EACN,iCAAiC,EACjC,+BAA+B,EAC/B,iCAAiC,EACjC,+BAA+B,EAC/B,gCAAgC,EAChC,8BAA8B,EAC9B,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,GACnB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-specific Reference Types
|
|
3
|
+
*
|
|
4
|
+
* These types define the platform-specific data structures that are preserved
|
|
5
|
+
* in the platformData field of internal messages. They provide type-safe access
|
|
6
|
+
* to the original webhook payload data when handlers need platform-specific details.
|
|
7
|
+
*
|
|
8
|
+
* @module messages/platform-refs
|
|
9
|
+
*/
|
|
10
|
+
import type * as LinearSDK from "@linear/sdk";
|
|
11
|
+
/**
|
|
12
|
+
* Linear platform reference types.
|
|
13
|
+
* These map to Linear SDK types used in webhook payloads.
|
|
14
|
+
*/
|
|
15
|
+
export interface LinearPlatformRef {
|
|
16
|
+
/** Agent session data from webhook */
|
|
17
|
+
agentSession: {
|
|
18
|
+
/** Session ID */
|
|
19
|
+
id: string;
|
|
20
|
+
/** Session status */
|
|
21
|
+
status: string;
|
|
22
|
+
/** Session type */
|
|
23
|
+
type?: string;
|
|
24
|
+
/** External link */
|
|
25
|
+
externalLink?: string;
|
|
26
|
+
/** Creator ID */
|
|
27
|
+
creatorId?: string;
|
|
28
|
+
/** Comment that triggered the session (if any) */
|
|
29
|
+
comment?: {
|
|
30
|
+
id: string;
|
|
31
|
+
body?: string;
|
|
32
|
+
};
|
|
33
|
+
/** Issue associated with the session */
|
|
34
|
+
issue: LinearPlatformRef["issue"];
|
|
35
|
+
};
|
|
36
|
+
/** Issue data from webhook */
|
|
37
|
+
issue: {
|
|
38
|
+
/** Issue ID */
|
|
39
|
+
id: string;
|
|
40
|
+
/** Human-readable identifier (e.g., "DEF-123") */
|
|
41
|
+
identifier: string;
|
|
42
|
+
/** Issue title */
|
|
43
|
+
title: string;
|
|
44
|
+
/** Issue description */
|
|
45
|
+
description?: string;
|
|
46
|
+
/** Issue URL */
|
|
47
|
+
url: string;
|
|
48
|
+
/** Branch name */
|
|
49
|
+
branchName?: string;
|
|
50
|
+
/** Team associated with the issue */
|
|
51
|
+
team?: {
|
|
52
|
+
id: string;
|
|
53
|
+
name?: string;
|
|
54
|
+
key?: string;
|
|
55
|
+
};
|
|
56
|
+
/** Project associated with the issue */
|
|
57
|
+
project?: {
|
|
58
|
+
id: string;
|
|
59
|
+
name?: string;
|
|
60
|
+
key?: string;
|
|
61
|
+
};
|
|
62
|
+
/** Labels attached to the issue */
|
|
63
|
+
labels?: Array<{
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
}>;
|
|
67
|
+
};
|
|
68
|
+
/** Comment data from webhook */
|
|
69
|
+
comment: {
|
|
70
|
+
/** Comment ID */
|
|
71
|
+
id: string;
|
|
72
|
+
/** Comment body */
|
|
73
|
+
body?: string;
|
|
74
|
+
/** Comment author */
|
|
75
|
+
user?: {
|
|
76
|
+
id: string;
|
|
77
|
+
name?: string;
|
|
78
|
+
displayName?: string;
|
|
79
|
+
email?: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
/** Agent activity data from webhook */
|
|
83
|
+
agentActivity: {
|
|
84
|
+
/** Activity ID */
|
|
85
|
+
id: string;
|
|
86
|
+
/** Activity type */
|
|
87
|
+
type?: string;
|
|
88
|
+
/** Activity signal (e.g., "stop") */
|
|
89
|
+
signal?: LinearSDK.AgentActivitySignal;
|
|
90
|
+
/** Activity content */
|
|
91
|
+
content?: {
|
|
92
|
+
/** Content type */
|
|
93
|
+
type?: string;
|
|
94
|
+
/** Content body (for user prompts) */
|
|
95
|
+
body?: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* GitHub platform reference types.
|
|
101
|
+
* These map to GitHub webhook payload structures.
|
|
102
|
+
*/
|
|
103
|
+
export interface GitHubPlatformRef {
|
|
104
|
+
/** Repository data from webhook */
|
|
105
|
+
repository: {
|
|
106
|
+
/** Repository ID */
|
|
107
|
+
id: number;
|
|
108
|
+
/** Repository name */
|
|
109
|
+
name: string;
|
|
110
|
+
/** Full repository name (owner/repo) */
|
|
111
|
+
fullName: string;
|
|
112
|
+
/** Repository HTML URL */
|
|
113
|
+
htmlUrl: string;
|
|
114
|
+
/** Clone URL */
|
|
115
|
+
cloneUrl: string;
|
|
116
|
+
/** SSH URL */
|
|
117
|
+
sshUrl: string;
|
|
118
|
+
/** Default branch */
|
|
119
|
+
defaultBranch: string;
|
|
120
|
+
/** Repository owner */
|
|
121
|
+
owner: {
|
|
122
|
+
login: string;
|
|
123
|
+
id: number;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
/** Pull request data from webhook */
|
|
127
|
+
pullRequest: {
|
|
128
|
+
/** PR ID */
|
|
129
|
+
id: number;
|
|
130
|
+
/** PR number */
|
|
131
|
+
number: number;
|
|
132
|
+
/** PR title */
|
|
133
|
+
title: string;
|
|
134
|
+
/** PR body */
|
|
135
|
+
body: string | null;
|
|
136
|
+
/** PR state */
|
|
137
|
+
state: string;
|
|
138
|
+
/** PR HTML URL */
|
|
139
|
+
htmlUrl: string;
|
|
140
|
+
/** Head branch ref */
|
|
141
|
+
headRef: string;
|
|
142
|
+
/** Head branch SHA */
|
|
143
|
+
headSha: string;
|
|
144
|
+
/** Base branch ref */
|
|
145
|
+
baseRef: string;
|
|
146
|
+
/** PR author */
|
|
147
|
+
user: {
|
|
148
|
+
login: string;
|
|
149
|
+
id: number;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
/** Issue data from webhook (used for issue comments) */
|
|
153
|
+
issue: {
|
|
154
|
+
/** Issue ID */
|
|
155
|
+
id: number;
|
|
156
|
+
/** Issue number */
|
|
157
|
+
number: number;
|
|
158
|
+
/** Issue title */
|
|
159
|
+
title: string;
|
|
160
|
+
/** Issue body */
|
|
161
|
+
body: string | null;
|
|
162
|
+
/** Issue state */
|
|
163
|
+
state: string;
|
|
164
|
+
/** Issue HTML URL */
|
|
165
|
+
htmlUrl: string;
|
|
166
|
+
/** Issue author */
|
|
167
|
+
user: {
|
|
168
|
+
login: string;
|
|
169
|
+
id: number;
|
|
170
|
+
};
|
|
171
|
+
/** Present when the issue is actually a PR */
|
|
172
|
+
isPullRequest: boolean;
|
|
173
|
+
};
|
|
174
|
+
/** Comment data from webhook */
|
|
175
|
+
comment: {
|
|
176
|
+
/** Comment ID */
|
|
177
|
+
id: number;
|
|
178
|
+
/** Comment body */
|
|
179
|
+
body: string;
|
|
180
|
+
/** Comment HTML URL */
|
|
181
|
+
htmlUrl: string;
|
|
182
|
+
/** Comment author */
|
|
183
|
+
user: {
|
|
184
|
+
login: string;
|
|
185
|
+
id: number;
|
|
186
|
+
avatarUrl: string;
|
|
187
|
+
};
|
|
188
|
+
/** Comment creation timestamp */
|
|
189
|
+
createdAt: string;
|
|
190
|
+
/** For PR review comments: the file path */
|
|
191
|
+
path?: string;
|
|
192
|
+
/** For PR review comments: the diff hunk */
|
|
193
|
+
diffHunk?: string;
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Slack platform reference types.
|
|
198
|
+
* Placeholder for future Slack integration.
|
|
199
|
+
*/
|
|
200
|
+
export interface SlackPlatformRef {
|
|
201
|
+
/** Channel data */
|
|
202
|
+
channel: {
|
|
203
|
+
/** Channel ID */
|
|
204
|
+
id: string;
|
|
205
|
+
/** Channel name */
|
|
206
|
+
name?: string;
|
|
207
|
+
};
|
|
208
|
+
/** Thread data */
|
|
209
|
+
thread: {
|
|
210
|
+
/** Thread timestamp */
|
|
211
|
+
ts: string;
|
|
212
|
+
/** Parent message timestamp */
|
|
213
|
+
parentTs?: string;
|
|
214
|
+
};
|
|
215
|
+
/** Message data */
|
|
216
|
+
message: {
|
|
217
|
+
/** Message timestamp */
|
|
218
|
+
ts: string;
|
|
219
|
+
/** Message text */
|
|
220
|
+
text: string;
|
|
221
|
+
/** Message author */
|
|
222
|
+
user: {
|
|
223
|
+
id: string;
|
|
224
|
+
name?: string;
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=platform-refs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-refs.d.ts","sourceRoot":"","sources":["../../src/messages/platform-refs.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,KAAK,SAAS,MAAM,aAAa,CAAC;AAM9C;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC,sCAAsC;IACtC,YAAY,EAAE;QACb,iBAAiB;QACjB,EAAE,EAAE,MAAM,CAAC;QACX,qBAAqB;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,mBAAmB;QACnB,IAAI,CA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BAAgB;IAChC,mBAAmB;IACnB,OAAO,EAAE;QACR,iBAAiB;QACjB,EAAE,EAAE,MAAM,CAAC;QACX,mBAAmB;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;IAEF,kBAAkB;IAClB,MAAM,EAAE;QACP,uBAAuB;QACvB,EAAE,EAAE,MAAM,CAAC;QACX,+BAA+B;QAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IAEF,mBAAmB;IACnB,OAAO,EAAE;QACR,wBAAwB;QACxB,EAAE,EAAE,MAAM,CAAC;QACX,mBAAmB;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,qBAAqB;QACrB,IAAI,EAAE;YACL,EAAE,EAAE,MAAM,CAAC;YACX,IAAI,CAAC,EAAE,MAAM,CAAC;SACd,CAAC;KACF,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-specific Reference Types
|
|
3
|
+
*
|
|
4
|
+
* These types define the platform-specific data structures that are preserved
|
|
5
|
+
* in the platformData field of internal messages. They provide type-safe access
|
|
6
|
+
* to the original webhook payload data when handlers need platform-specific details.
|
|
7
|
+
*
|
|
8
|
+
* @module messages/platform-refs
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=platform-refs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-refs.js","sourceRoot":"","sources":["../../src/messages/platform-refs.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type Guards for Internal Messages
|
|
3
|
+
*
|
|
4
|
+
* This module provides type guard functions for discriminating between
|
|
5
|
+
* different internal message types based on the `action` field.
|
|
6
|
+
*
|
|
7
|
+
* @module messages/type-guards
|
|
8
|
+
*/
|
|
9
|
+
import type { ContentUpdateMessage, GitHubSessionStartPlatformData, GitHubUserPromptPlatformData, InternalMessage, LinearSessionStartPlatformData, LinearUserPromptPlatformData, SessionStartMessage, SlackSessionStartPlatformData, SlackUserPromptPlatformData, StopSignalMessage, UnassignMessage, UserPromptMessage } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Type guard for SessionStartMessage.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isSessionStartMessage(message: InternalMessage): message is SessionStartMessage;
|
|
14
|
+
/**
|
|
15
|
+
* Type guard for UserPromptMessage.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isUserPromptMessage(message: InternalMessage): message is UserPromptMessage;
|
|
18
|
+
/**
|
|
19
|
+
* Type guard for StopSignalMessage.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isStopSignalMessage(message: InternalMessage): message is StopSignalMessage;
|
|
22
|
+
/**
|
|
23
|
+
* Type guard for ContentUpdateMessage.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isContentUpdateMessage(message: InternalMessage): message is ContentUpdateMessage;
|
|
26
|
+
/**
|
|
27
|
+
* Type guard for UnassignMessage.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isUnassignMessage(message: InternalMessage): message is UnassignMessage;
|
|
30
|
+
/**
|
|
31
|
+
* Type guard to check if message is from Linear.
|
|
32
|
+
*/
|
|
33
|
+
export declare function isLinearMessage(message: InternalMessage): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Type guard to check if message is from GitHub.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isGitHubMessage(message: InternalMessage): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Type guard to check if message is from Slack.
|
|
40
|
+
*/
|
|
41
|
+
export declare function isSlackMessage(message: InternalMessage): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Type guard for Linear platform data in SessionStartMessage.
|
|
44
|
+
*/
|
|
45
|
+
export declare function hasLinearSessionStartPlatformData(message: SessionStartMessage): message is SessionStartMessage & {
|
|
46
|
+
platformData: LinearSessionStartPlatformData;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Type guard for GitHub platform data in SessionStartMessage.
|
|
50
|
+
*/
|
|
51
|
+
export declare function hasGitHubSessionStartPlatformData(message: SessionStartMessage): message is SessionStartMessage & {
|
|
52
|
+
platformData: GitHubSessionStartPlatformData;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Type guard for Linear platform data in UserPromptMessage.
|
|
56
|
+
*/
|
|
57
|
+
export declare function hasLinearUserPromptPlatformData(message: UserPromptMessage): message is UserPromptMessage & {
|
|
58
|
+
platformData: LinearUserPromptPlatformData;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Type guard for GitHub platform data in UserPromptMessage.
|
|
62
|
+
*/
|
|
63
|
+
export declare function hasGitHubUserPromptPlatformData(message: UserPromptMessage): message is UserPromptMessage & {
|
|
64
|
+
platformData: GitHubUserPromptPlatformData;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Type guard for Slack platform data in SessionStartMessage.
|
|
68
|
+
*/
|
|
69
|
+
export declare function hasSlackSessionStartPlatformData(message: SessionStartMessage): message is SessionStartMessage & {
|
|
70
|
+
platformData: SlackSessionStartPlatformData;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Type guard for Slack platform data in UserPromptMessage.
|
|
74
|
+
*/
|
|
75
|
+
export declare function hasSlackUserPromptPlatformData(message: UserPromptMessage): message is UserPromptMessage & {
|
|
76
|
+
platformData: SlackUserPromptPlatformData;
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=type-guards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-guards.d.ts","sourceRoot":"","sources":["../../src/messages/type-guards.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACX,oBAAoB,EACpB,8BAA8B,EAC9B,4BAA4B,EAC5B,eAAe,EACf,8BAA8B,EAC9B,4BAA4B,EAC5B,mBAAmB,EACnB,6BAA6B,EAC7B,2BA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