@hailer/mcp 0.1.10 → 0.1.12
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/.claude/settings.json +12 -0
- package/CLAUDE.md +37 -1
- package/ai-hub/dist/assets/index-8ce6041d.css +1 -0
- package/ai-hub/dist/assets/index-930f01ca.js +348 -0
- package/ai-hub/dist/index.html +15 -0
- package/ai-hub/dist/manifest.json +14 -0
- package/ai-hub/dist/vite.svg +1 -0
- package/dist/app.js +5 -0
- package/dist/client/agents/base.d.ts +5 -0
- package/dist/client/agents/base.js +9 -2
- package/dist/client/agents/definitions.js +85 -0
- package/dist/client/agents/orchestrator.d.ts +21 -0
- package/dist/client/agents/orchestrator.js +292 -1
- package/dist/client/bot-entrypoint.d.ts +7 -0
- package/dist/client/bot-entrypoint.js +103 -0
- package/dist/client/bot-runner.d.ts +35 -0
- package/dist/client/bot-runner.js +188 -0
- package/dist/client/factory.d.ts +4 -0
- package/dist/client/factory.js +10 -0
- package/dist/client/server.d.ts +8 -0
- package/dist/client/server.js +251 -0
- package/dist/client/types.d.ts +29 -0
- package/dist/client/types.js +4 -1
- package/dist/core.d.ts +3 -0
- package/dist/core.js +72 -0
- package/dist/mcp/hailer-clients.d.ts +4 -0
- package/dist/mcp/hailer-clients.js +16 -1
- package/dist/mcp/tools/app-scaffold.js +148 -11
- package/dist/mcp/tools/bot-config.d.ts +78 -0
- package/dist/mcp/tools/bot-config.js +442 -0
- package/dist/mcp-server.js +109 -1
- package/dist/modules/bug-reports/bug-config.d.ts +25 -0
- package/dist/modules/bug-reports/bug-config.js +187 -0
- package/dist/modules/bug-reports/bug-monitor.d.ts +108 -0
- package/dist/modules/bug-reports/bug-monitor.js +510 -0
- package/dist/modules/bug-reports/giuseppe-ai.d.ts +59 -0
- package/dist/modules/bug-reports/giuseppe-ai.js +335 -0
- package/dist/modules/bug-reports/giuseppe-bot.d.ts +109 -0
- package/dist/modules/bug-reports/giuseppe-bot.js +765 -0
- package/dist/modules/bug-reports/giuseppe-files.d.ts +52 -0
- package/dist/modules/bug-reports/giuseppe-files.js +338 -0
- package/dist/modules/bug-reports/giuseppe-git.d.ts +48 -0
- package/dist/modules/bug-reports/giuseppe-git.js +298 -0
- package/dist/modules/bug-reports/giuseppe-prompt.d.ts +5 -0
- package/dist/modules/bug-reports/giuseppe-prompt.js +94 -0
- package/dist/modules/bug-reports/index.d.ts +76 -0
- package/dist/modules/bug-reports/index.js +213 -0
- package/dist/modules/bug-reports/pending-classification-registry.d.ts +28 -0
- package/dist/modules/bug-reports/pending-classification-registry.js +50 -0
- package/dist/modules/bug-reports/pending-fix-registry.d.ts +30 -0
- package/dist/modules/bug-reports/pending-fix-registry.js +42 -0
- package/dist/modules/bug-reports/pending-registry.d.ts +27 -0
- package/dist/modules/bug-reports/pending-registry.js +49 -0
- package/dist/modules/bug-reports/types.d.ts +123 -0
- package/dist/modules/bug-reports/types.js +9 -0
- package/dist/services/bug-monitor.d.ts +23 -0
- package/dist/services/bug-monitor.js +275 -0
- package/lineup-manager/dist/assets/index-b30c809f.js +600 -0
- package/lineup-manager/dist/index.html +1 -1
- package/lineup-manager/dist/manifest.json +5 -5
- package/package.json +6 -2
- package/lineup-manager/dist/assets/index-e168f265.js +0 -600
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Bug Reports Module
|
|
4
|
+
*
|
|
5
|
+
* Self-contained module for bug monitoring and auto-fixing.
|
|
6
|
+
* No hardcoded IDs - discovers workflow by name pattern.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* import { BugReportsModule } from './modules/bug-reports';
|
|
10
|
+
*
|
|
11
|
+
* const module = new BugReportsModule(userContext);
|
|
12
|
+
* await module.start();
|
|
13
|
+
*
|
|
14
|
+
* Configuration (in order of precedence):
|
|
15
|
+
* 1. Hailer "MCP Config" workflow activity named "Bug Reports Config"
|
|
16
|
+
* 2. Environment variables (BUG_MONITOR_*)
|
|
17
|
+
* 3. Default values
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.GIUSEPPE_SYSTEM_PROMPT = exports.GiuseppeFiles = exports.GiuseppeGit = exports.GiuseppeAI = exports.pendingClassificationRegistry = exports.pendingFixRegistry = exports.PendingRegistry = exports.getDefaultConfig = exports.discoverWorkflow = exports.loadConfig = exports.GiuseppeBot = exports.BugMonitor = exports.BugReportsModule = void 0;
|
|
21
|
+
const logger_1 = require("../../lib/logger");
|
|
22
|
+
const bug_monitor_1 = require("./bug-monitor");
|
|
23
|
+
const giuseppe_bot_1 = require("./giuseppe-bot");
|
|
24
|
+
const bug_config_1 = require("./bug-config");
|
|
25
|
+
const logger = (0, logger_1.createLogger)({ component: 'bug-reports-module' });
|
|
26
|
+
class BugReportsModule {
|
|
27
|
+
userContext;
|
|
28
|
+
monitor;
|
|
29
|
+
giuseppe;
|
|
30
|
+
config;
|
|
31
|
+
started = false;
|
|
32
|
+
constructor(userContext) {
|
|
33
|
+
this.userContext = userContext;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Register a bot user ID to ignore messages from
|
|
37
|
+
* Call this before start() to ensure all bots are registered
|
|
38
|
+
*/
|
|
39
|
+
registerBotUser(userId) {
|
|
40
|
+
if (this.monitor) {
|
|
41
|
+
this.monitor.registerBotUser(userId);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
// Store for later if monitor not created yet
|
|
45
|
+
this._pendingBotUsers = this._pendingBotUsers || [];
|
|
46
|
+
this._pendingBotUsers.push(userId);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
_pendingBotUsers;
|
|
50
|
+
/**
|
|
51
|
+
* Register a handler for when Giuseppe is disabled but a bug is found
|
|
52
|
+
* Call this before start() to ensure handler is registered
|
|
53
|
+
*/
|
|
54
|
+
onGiuseppeDisabled(handler) {
|
|
55
|
+
if (this.monitor) {
|
|
56
|
+
this.monitor.onGiuseppeDisabled(handler);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// Store for later if monitor not created yet
|
|
60
|
+
this._pendingGiuseppeDisabledHandlers = this._pendingGiuseppeDisabledHandlers || [];
|
|
61
|
+
this._pendingGiuseppeDisabledHandlers.push(handler);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
_pendingGiuseppeDisabledHandlers;
|
|
65
|
+
/**
|
|
66
|
+
* Start the bug reports module
|
|
67
|
+
*/
|
|
68
|
+
async start() {
|
|
69
|
+
if (this.started) {
|
|
70
|
+
logger.warn('BugReportsModule already started');
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
logger.info('Starting Bug Reports Module...');
|
|
74
|
+
try {
|
|
75
|
+
// Load configuration
|
|
76
|
+
this.config = await (0, bug_config_1.loadConfig)(this.userContext);
|
|
77
|
+
if (!this.config.enabled) {
|
|
78
|
+
logger.info('Bug Reports Module is disabled');
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
// Create monitor
|
|
82
|
+
this.monitor = new bug_monitor_1.BugMonitor(this.userContext);
|
|
83
|
+
// Register any pending bot users
|
|
84
|
+
if (this._pendingBotUsers) {
|
|
85
|
+
for (const userId of this._pendingBotUsers) {
|
|
86
|
+
this.monitor.registerBotUser(userId);
|
|
87
|
+
}
|
|
88
|
+
this._pendingBotUsers = undefined;
|
|
89
|
+
}
|
|
90
|
+
// Register any pending giuseppe disabled handlers
|
|
91
|
+
if (this._pendingGiuseppeDisabledHandlers) {
|
|
92
|
+
for (const handler of this._pendingGiuseppeDisabledHandlers) {
|
|
93
|
+
this.monitor.onGiuseppeDisabled(handler);
|
|
94
|
+
}
|
|
95
|
+
this._pendingGiuseppeDisabledHandlers = undefined;
|
|
96
|
+
}
|
|
97
|
+
// Create Giuseppe bot if auto-fix is enabled
|
|
98
|
+
if (this.config.autoFix) {
|
|
99
|
+
if (!this.config.anthropicApiKey && !process.env.ANTHROPIC_API_KEY) {
|
|
100
|
+
logger.warn('Auto-fix enabled but no ANTHROPIC_API_KEY - Giuseppe disabled');
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
this.giuseppe = new giuseppe_bot_1.GiuseppeBot(this.userContext, this.config, this.monitor);
|
|
104
|
+
// Initialize registry callback for HAL coordination
|
|
105
|
+
this.giuseppe.initializeRegistryCallback();
|
|
106
|
+
this.giuseppe.initializeClassificationCallbacks();
|
|
107
|
+
// Register Giuseppe as bug handler
|
|
108
|
+
this.monitor.onNewBug(async (bug) => {
|
|
109
|
+
const result = await this.giuseppe.handleBug(bug);
|
|
110
|
+
logger.info('Giuseppe fix result', {
|
|
111
|
+
bugId: bug.id,
|
|
112
|
+
success: result.success,
|
|
113
|
+
summary: result.summary
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
// Register Giuseppe as message handler (for approval messages)
|
|
117
|
+
this.monitor.onMessage(async (discussionId, message, senderId) => {
|
|
118
|
+
const result = await this.giuseppe.handleDiscussionMessage(discussionId, message, senderId);
|
|
119
|
+
if (result.approved) {
|
|
120
|
+
logger.info('Fix approved', {
|
|
121
|
+
discussionId,
|
|
122
|
+
published: result.published,
|
|
123
|
+
error: result.error
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
logger.info('Giuseppe Bot enabled for auto-fixing');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// Start monitoring
|
|
131
|
+
await this.monitor.start();
|
|
132
|
+
this.started = true;
|
|
133
|
+
logger.info('Bug Reports Module started', {
|
|
134
|
+
autoFix: !!this.giuseppe,
|
|
135
|
+
notifyOnNew: this.config.notifyOnNew,
|
|
136
|
+
intervalMs: this.config.intervalMs
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
logger.error('Failed to start Bug Reports Module', { error });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Stop the module
|
|
145
|
+
*/
|
|
146
|
+
async stop() {
|
|
147
|
+
if (this.monitor) {
|
|
148
|
+
await this.monitor.stop();
|
|
149
|
+
}
|
|
150
|
+
this.started = false;
|
|
151
|
+
logger.info('Bug Reports Module stopped');
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Get current configuration
|
|
155
|
+
*/
|
|
156
|
+
getConfig() {
|
|
157
|
+
return this.config || (0, bug_config_1.getDefaultConfig)();
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Check if module is running
|
|
161
|
+
*/
|
|
162
|
+
isRunning() {
|
|
163
|
+
return this.started;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Manually trigger a bug fix (for testing or manual dispatch)
|
|
167
|
+
*/
|
|
168
|
+
async fixBug(bug) {
|
|
169
|
+
if (!this.giuseppe) {
|
|
170
|
+
return {
|
|
171
|
+
success: false,
|
|
172
|
+
summary: 'Giuseppe Bot not initialized (autoFix disabled or no API key)'
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
return this.giuseppe.handleBug(bug);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Register a custom bug handler
|
|
179
|
+
*/
|
|
180
|
+
onNewBug(handler) {
|
|
181
|
+
if (this.monitor) {
|
|
182
|
+
this.monitor.onNewBug(handler);
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
logger.warn('Cannot register handler - monitor not initialized');
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
exports.BugReportsModule = BugReportsModule;
|
|
190
|
+
var bug_monitor_2 = require("./bug-monitor");
|
|
191
|
+
Object.defineProperty(exports, "BugMonitor", { enumerable: true, get: function () { return bug_monitor_2.BugMonitor; } });
|
|
192
|
+
var giuseppe_bot_2 = require("./giuseppe-bot");
|
|
193
|
+
Object.defineProperty(exports, "GiuseppeBot", { enumerable: true, get: function () { return giuseppe_bot_2.GiuseppeBot; } });
|
|
194
|
+
var bug_config_2 = require("./bug-config");
|
|
195
|
+
Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function () { return bug_config_2.loadConfig; } });
|
|
196
|
+
Object.defineProperty(exports, "discoverWorkflow", { enumerable: true, get: function () { return bug_config_2.discoverWorkflow; } });
|
|
197
|
+
Object.defineProperty(exports, "getDefaultConfig", { enumerable: true, get: function () { return bug_config_2.getDefaultConfig; } });
|
|
198
|
+
var pending_registry_1 = require("./pending-registry");
|
|
199
|
+
Object.defineProperty(exports, "PendingRegistry", { enumerable: true, get: function () { return pending_registry_1.PendingRegistry; } });
|
|
200
|
+
var pending_fix_registry_1 = require("./pending-fix-registry");
|
|
201
|
+
Object.defineProperty(exports, "pendingFixRegistry", { enumerable: true, get: function () { return pending_fix_registry_1.pendingFixRegistry; } });
|
|
202
|
+
var pending_classification_registry_1 = require("./pending-classification-registry");
|
|
203
|
+
Object.defineProperty(exports, "pendingClassificationRegistry", { enumerable: true, get: function () { return pending_classification_registry_1.pendingClassificationRegistry; } });
|
|
204
|
+
// Export extracted Giuseppe modules
|
|
205
|
+
var giuseppe_ai_1 = require("./giuseppe-ai");
|
|
206
|
+
Object.defineProperty(exports, "GiuseppeAI", { enumerable: true, get: function () { return giuseppe_ai_1.GiuseppeAI; } });
|
|
207
|
+
var giuseppe_git_1 = require("./giuseppe-git");
|
|
208
|
+
Object.defineProperty(exports, "GiuseppeGit", { enumerable: true, get: function () { return giuseppe_git_1.GiuseppeGit; } });
|
|
209
|
+
var giuseppe_files_1 = require("./giuseppe-files");
|
|
210
|
+
Object.defineProperty(exports, "GiuseppeFiles", { enumerable: true, get: function () { return giuseppe_files_1.GiuseppeFiles; } });
|
|
211
|
+
var giuseppe_prompt_1 = require("./giuseppe-prompt");
|
|
212
|
+
Object.defineProperty(exports, "GIUSEPPE_SYSTEM_PROMPT", { enumerable: true, get: function () { return giuseppe_prompt_1.GIUSEPPE_SYSTEM_PROMPT; } });
|
|
213
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pending Classification Registry - Tracks bug classifications awaiting confirmation
|
|
3
|
+
*/
|
|
4
|
+
import { PendingRegistry, PendingItem } from './pending-registry';
|
|
5
|
+
import type { BugReport } from './types';
|
|
6
|
+
export interface PendingClassificationInfo extends PendingItem {
|
|
7
|
+
bugId: string;
|
|
8
|
+
bugName: string;
|
|
9
|
+
appId?: string;
|
|
10
|
+
appName?: string;
|
|
11
|
+
classification: 'bug' | 'feature_request' | 'unclear';
|
|
12
|
+
reason: string;
|
|
13
|
+
bug: BugReport;
|
|
14
|
+
}
|
|
15
|
+
declare class PendingClassificationRegistry extends PendingRegistry<PendingClassificationInfo> {
|
|
16
|
+
private fixItCallback?;
|
|
17
|
+
private notABugCallback?;
|
|
18
|
+
constructor();
|
|
19
|
+
setCallbacks(fixItCallback: (discussionId: string) => Promise<void>, notABugCallback: (discussionId: string) => Promise<void>): void;
|
|
20
|
+
triggerFixIt(discussionId: string): Promise<boolean>;
|
|
21
|
+
triggerNotABug(discussionId: string): Promise<boolean>;
|
|
22
|
+
hasPendingClassification(discussionId: string): boolean;
|
|
23
|
+
getPendingClassification(discussionId: string): PendingClassificationInfo | undefined;
|
|
24
|
+
getAllPendingClassifications(): PendingClassificationInfo[];
|
|
25
|
+
}
|
|
26
|
+
export declare const pendingClassificationRegistry: PendingClassificationRegistry;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=pending-classification-registry.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Pending Classification Registry - Tracks bug classifications awaiting confirmation
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.pendingClassificationRegistry = void 0;
|
|
7
|
+
const pending_registry_1 = require("./pending-registry");
|
|
8
|
+
class PendingClassificationRegistry extends pending_registry_1.PendingRegistry {
|
|
9
|
+
fixItCallback;
|
|
10
|
+
notABugCallback;
|
|
11
|
+
constructor() {
|
|
12
|
+
super('pending-classification-registry');
|
|
13
|
+
}
|
|
14
|
+
setCallbacks(fixItCallback, notABugCallback) {
|
|
15
|
+
this.fixItCallback = fixItCallback;
|
|
16
|
+
this.notABugCallback = notABugCallback;
|
|
17
|
+
}
|
|
18
|
+
async triggerFixIt(discussionId) {
|
|
19
|
+
if (!this.fixItCallback) {
|
|
20
|
+
this.logger.warn('No fixIt callback registered', { discussionId });
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if (!this.has(discussionId)) {
|
|
24
|
+
this.logger.warn('No pending classification to fix', { discussionId });
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
this.logger.info('Triggering fix it', { discussionId });
|
|
28
|
+
await this.fixItCallback(discussionId);
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
async triggerNotABug(discussionId) {
|
|
32
|
+
if (!this.notABugCallback) {
|
|
33
|
+
this.logger.warn('No notABug callback registered', { discussionId });
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
if (!this.has(discussionId)) {
|
|
37
|
+
this.logger.warn('No pending classification to decline', { discussionId });
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
this.logger.info('Triggering not a bug', { discussionId });
|
|
41
|
+
await this.notABugCallback(discussionId);
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
// Backward-compatible aliases
|
|
45
|
+
hasPendingClassification(discussionId) { return this.has(discussionId); }
|
|
46
|
+
getPendingClassification(discussionId) { return this.get(discussionId); }
|
|
47
|
+
getAllPendingClassifications() { return this.getAll(); }
|
|
48
|
+
}
|
|
49
|
+
exports.pendingClassificationRegistry = new PendingClassificationRegistry();
|
|
50
|
+
//# sourceMappingURL=pending-classification-registry.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pending Fix Registry - Tracks bug fixes awaiting approval
|
|
3
|
+
*/
|
|
4
|
+
import { PendingRegistry, PendingItem } from './pending-registry';
|
|
5
|
+
import type { BugReport, AppRegistryEntry } from './types';
|
|
6
|
+
import type { FixPlan } from './giuseppe-ai';
|
|
7
|
+
export interface PendingFixInfo extends PendingItem {
|
|
8
|
+
bugId: string;
|
|
9
|
+
appId: string;
|
|
10
|
+
state: 'awaiting_test' | 'awaiting_explanation';
|
|
11
|
+
fixSummary: string;
|
|
12
|
+
bug: BugReport;
|
|
13
|
+
app: AppRegistryEntry;
|
|
14
|
+
fixPlan: FixPlan;
|
|
15
|
+
filesModified: string[];
|
|
16
|
+
commitHash?: string;
|
|
17
|
+
}
|
|
18
|
+
declare class PendingFixRegistry extends PendingRegistry<PendingFixInfo> {
|
|
19
|
+
private retryCallback?;
|
|
20
|
+
constructor();
|
|
21
|
+
updateState(discussionId: string, state: PendingFixInfo['state']): void;
|
|
22
|
+
setRetryCallback(callback: (discussionId: string, explanation: string) => Promise<void>): void;
|
|
23
|
+
triggerRetry(discussionId: string, explanation: string): Promise<boolean>;
|
|
24
|
+
hasPendingFix(discussionId: string): boolean;
|
|
25
|
+
getPendingFix(discussionId: string): PendingFixInfo | undefined;
|
|
26
|
+
getAllPendingFixes(): PendingFixInfo[];
|
|
27
|
+
}
|
|
28
|
+
export declare const pendingFixRegistry: PendingFixRegistry;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=pending-fix-registry.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Pending Fix Registry - Tracks bug fixes awaiting approval
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.pendingFixRegistry = void 0;
|
|
7
|
+
const pending_registry_1 = require("./pending-registry");
|
|
8
|
+
class PendingFixRegistry extends pending_registry_1.PendingRegistry {
|
|
9
|
+
retryCallback;
|
|
10
|
+
constructor() {
|
|
11
|
+
super('pending-fix-registry');
|
|
12
|
+
}
|
|
13
|
+
updateState(discussionId, state) {
|
|
14
|
+
const fix = this.get(discussionId);
|
|
15
|
+
if (fix) {
|
|
16
|
+
fix.state = state;
|
|
17
|
+
this.logger.debug('Updated pending fix state', { discussionId, state });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
setRetryCallback(callback) {
|
|
21
|
+
this.retryCallback = callback;
|
|
22
|
+
}
|
|
23
|
+
async triggerRetry(discussionId, explanation) {
|
|
24
|
+
if (!this.retryCallback) {
|
|
25
|
+
this.logger.warn('No retry callback registered', { discussionId });
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
if (!this.has(discussionId)) {
|
|
29
|
+
this.logger.warn('No pending fix to retry', { discussionId });
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
this.logger.info('Triggering retry with explanation', { discussionId, explanationLength: explanation.length });
|
|
33
|
+
await this.retryCallback(discussionId, explanation);
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
// Backward-compatible aliases
|
|
37
|
+
hasPendingFix(discussionId) { return this.has(discussionId); }
|
|
38
|
+
getPendingFix(discussionId) { return this.get(discussionId); }
|
|
39
|
+
getAllPendingFixes() { return this.getAll(); }
|
|
40
|
+
}
|
|
41
|
+
exports.pendingFixRegistry = new PendingFixRegistry();
|
|
42
|
+
//# sourceMappingURL=pending-fix-registry.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic Pending Registry Base Class
|
|
3
|
+
*
|
|
4
|
+
* Shared foundation for PendingFixRegistry and PendingClassificationRegistry.
|
|
5
|
+
* Provides Map-based storage with register/unregister/has/get/getAll methods.
|
|
6
|
+
*/
|
|
7
|
+
import { Logger } from '../../lib/logger';
|
|
8
|
+
export interface PendingItem {
|
|
9
|
+
discussionId: string;
|
|
10
|
+
timestamp: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Generic registry for pending items keyed by discussionId
|
|
14
|
+
*/
|
|
15
|
+
export declare class PendingRegistry<T extends PendingItem> {
|
|
16
|
+
protected items: Map<string, T>;
|
|
17
|
+
protected logger: Logger;
|
|
18
|
+
constructor(component: string);
|
|
19
|
+
register(item: T): void;
|
|
20
|
+
unregister(discussionId: string): void;
|
|
21
|
+
has(discussionId: string): boolean;
|
|
22
|
+
get(discussionId: string): T | undefined;
|
|
23
|
+
getAll(): T[];
|
|
24
|
+
get size(): number;
|
|
25
|
+
clear(): void;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=pending-registry.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generic Pending Registry Base Class
|
|
4
|
+
*
|
|
5
|
+
* Shared foundation for PendingFixRegistry and PendingClassificationRegistry.
|
|
6
|
+
* Provides Map-based storage with register/unregister/has/get/getAll methods.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.PendingRegistry = void 0;
|
|
10
|
+
const logger_1 = require("../../lib/logger");
|
|
11
|
+
/**
|
|
12
|
+
* Generic registry for pending items keyed by discussionId
|
|
13
|
+
*/
|
|
14
|
+
class PendingRegistry {
|
|
15
|
+
items = new Map();
|
|
16
|
+
logger;
|
|
17
|
+
constructor(component) {
|
|
18
|
+
this.logger = (0, logger_1.createLogger)({ component });
|
|
19
|
+
}
|
|
20
|
+
register(item) {
|
|
21
|
+
this.items.set(item.discussionId, item);
|
|
22
|
+
this.logger.debug('Registered pending item', {
|
|
23
|
+
discussionId: item.discussionId,
|
|
24
|
+
timestamp: item.timestamp
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
unregister(discussionId) {
|
|
28
|
+
this.items.delete(discussionId);
|
|
29
|
+
this.logger.debug('Unregistered pending item', { discussionId });
|
|
30
|
+
}
|
|
31
|
+
has(discussionId) {
|
|
32
|
+
return this.items.has(discussionId);
|
|
33
|
+
}
|
|
34
|
+
get(discussionId) {
|
|
35
|
+
return this.items.get(discussionId);
|
|
36
|
+
}
|
|
37
|
+
getAll() {
|
|
38
|
+
return Array.from(this.items.values());
|
|
39
|
+
}
|
|
40
|
+
get size() {
|
|
41
|
+
return this.items.size;
|
|
42
|
+
}
|
|
43
|
+
clear() {
|
|
44
|
+
this.items.clear();
|
|
45
|
+
this.logger.debug('Cleared all pending items');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.PendingRegistry = PendingRegistry;
|
|
49
|
+
//# sourceMappingURL=pending-registry.js.map
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bug Reports Module - Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Shared types for the bug monitoring and auto-fix system.
|
|
5
|
+
* No hardcoded IDs - everything discovered by name patterns.
|
|
6
|
+
*/
|
|
7
|
+
export interface BugReportsConfig {
|
|
8
|
+
/** Enable/disable the bug monitor */
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
/** Workflow name pattern to find Bug Reports workflow */
|
|
11
|
+
workflowNamePattern: string;
|
|
12
|
+
/** Phase names for bug lifecycle */
|
|
13
|
+
phaseNames: {
|
|
14
|
+
new: string;
|
|
15
|
+
inProgress: string;
|
|
16
|
+
fixed: string;
|
|
17
|
+
closed: string;
|
|
18
|
+
declined: string;
|
|
19
|
+
};
|
|
20
|
+
/** Polling interval in milliseconds */
|
|
21
|
+
intervalMs: number;
|
|
22
|
+
/** Enable auto-fix via Giuseppe bot */
|
|
23
|
+
autoFix: boolean;
|
|
24
|
+
/** Post notifications to bug discussions */
|
|
25
|
+
notifyOnNew: boolean;
|
|
26
|
+
/** Anthropic API key for Giuseppe bot (if autoFix enabled) */
|
|
27
|
+
anthropicApiKey?: string;
|
|
28
|
+
/** Apps registry - maps appId to project paths */
|
|
29
|
+
appsRegistry?: Record<string, AppRegistryEntry>;
|
|
30
|
+
}
|
|
31
|
+
export interface AppRegistryEntry {
|
|
32
|
+
/** Local path to app project */
|
|
33
|
+
projectPath: string;
|
|
34
|
+
/** App name for reference */
|
|
35
|
+
name: string;
|
|
36
|
+
/** Git remote URL (optional) */
|
|
37
|
+
gitRemote?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface BugReport {
|
|
40
|
+
/** Activity ID */
|
|
41
|
+
id: string;
|
|
42
|
+
/** Bug title/name */
|
|
43
|
+
name: string;
|
|
44
|
+
/** App ID this bug relates to */
|
|
45
|
+
appId?: string;
|
|
46
|
+
/** App name */
|
|
47
|
+
appName?: string;
|
|
48
|
+
/** Who reported the bug */
|
|
49
|
+
reportedBy?: string;
|
|
50
|
+
/** Bug description */
|
|
51
|
+
description: string;
|
|
52
|
+
/** Steps to reproduce */
|
|
53
|
+
stepsToReproduce?: string;
|
|
54
|
+
/** Expected behavior */
|
|
55
|
+
expectedBehavior?: string;
|
|
56
|
+
/** Actual behavior */
|
|
57
|
+
actualBehavior?: string;
|
|
58
|
+
/** Priority level */
|
|
59
|
+
priority?: 'low' | 'medium' | 'high' | 'critical';
|
|
60
|
+
/** Discussion ID for posting updates */
|
|
61
|
+
discussionId?: string;
|
|
62
|
+
/** Workflow ID */
|
|
63
|
+
workflowId: string;
|
|
64
|
+
/** Current phase ID */
|
|
65
|
+
phaseId: string;
|
|
66
|
+
/** Creation timestamp */
|
|
67
|
+
createdAt: string;
|
|
68
|
+
/** Who created the bug activity (user ID) */
|
|
69
|
+
createdBy?: string;
|
|
70
|
+
/** Raw field values for custom parsing */
|
|
71
|
+
rawFields?: Record<string, any>;
|
|
72
|
+
}
|
|
73
|
+
export interface WorkflowDiscoveryResult {
|
|
74
|
+
/** Found workflow ID */
|
|
75
|
+
workflowId: string;
|
|
76
|
+
/** Workflow name */
|
|
77
|
+
workflowName: string;
|
|
78
|
+
/** Phase ID mappings */
|
|
79
|
+
phases: {
|
|
80
|
+
new?: string;
|
|
81
|
+
inProgress?: string;
|
|
82
|
+
fixed?: string;
|
|
83
|
+
closed?: string;
|
|
84
|
+
declined?: string;
|
|
85
|
+
};
|
|
86
|
+
/** Field ID mappings (discovered by label) */
|
|
87
|
+
fields: {
|
|
88
|
+
appId?: string;
|
|
89
|
+
appName?: string;
|
|
90
|
+
description?: string;
|
|
91
|
+
stepsToReproduce?: string;
|
|
92
|
+
expectedBehavior?: string;
|
|
93
|
+
actualBehavior?: string;
|
|
94
|
+
reportedBy?: string;
|
|
95
|
+
priority?: string;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export interface FixResult {
|
|
99
|
+
success: boolean;
|
|
100
|
+
/** What was done */
|
|
101
|
+
summary: string;
|
|
102
|
+
/** Files modified */
|
|
103
|
+
filesModified?: string[];
|
|
104
|
+
/** Commit hash if committed */
|
|
105
|
+
commitHash?: string;
|
|
106
|
+
/** New version if published */
|
|
107
|
+
publishedVersion?: string;
|
|
108
|
+
/** Error message if failed */
|
|
109
|
+
error?: string;
|
|
110
|
+
/** Detailed log of actions */
|
|
111
|
+
log?: string[];
|
|
112
|
+
}
|
|
113
|
+
export interface GiuseppeTaskInput {
|
|
114
|
+
/** The bug to fix */
|
|
115
|
+
bug: BugReport;
|
|
116
|
+
/** App project info */
|
|
117
|
+
app: AppRegistryEntry;
|
|
118
|
+
/** Whether to auto-publish after fix */
|
|
119
|
+
autoPublish: boolean;
|
|
120
|
+
/** Hailer app ID for publishing */
|
|
121
|
+
hailerAppId?: string;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Bug Reports Module - Type Definitions
|
|
4
|
+
*
|
|
5
|
+
* Shared types for the bug monitoring and auto-fix system.
|
|
6
|
+
* No hardcoded IDs - everything discovered by name patterns.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bug Monitor Service
|
|
3
|
+
*
|
|
4
|
+
* Periodically checks for new bug reports and can trigger auto-fix workflows.
|
|
5
|
+
* Configuration is read from Hailer's MCP Config workflow.
|
|
6
|
+
*/
|
|
7
|
+
export declare class BugMonitorService {
|
|
8
|
+
private interval?;
|
|
9
|
+
private config?;
|
|
10
|
+
private userContext?;
|
|
11
|
+
private bugWorkflowId?;
|
|
12
|
+
private newPhaseId?;
|
|
13
|
+
private fixedPhaseId?;
|
|
14
|
+
private processedBugIds;
|
|
15
|
+
start(): Promise<void>;
|
|
16
|
+
stop(): Promise<void>;
|
|
17
|
+
private loadConfig;
|
|
18
|
+
private findBugWorkflow;
|
|
19
|
+
private checkForNewBugs;
|
|
20
|
+
private processBug;
|
|
21
|
+
}
|
|
22
|
+
export declare function getBugMonitor(): BugMonitorService;
|
|
23
|
+
//# sourceMappingURL=bug-monitor.d.ts.map
|