@hailer/mcp 0.1.15 → 0.1.16

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.
Files changed (112) hide show
  1. package/.claude/agents/agent-giuseppe-app-builder.md +7 -6
  2. package/.claude/agents/agent-lars-code-inspector.md +26 -14
  3. package/dist/agents/bot-manager.d.ts +48 -0
  4. package/dist/agents/bot-manager.js +254 -0
  5. package/dist/agents/factory.d.ts +150 -0
  6. package/dist/agents/factory.js +650 -0
  7. package/dist/agents/giuseppe/ai.d.ts +83 -0
  8. package/dist/agents/giuseppe/ai.js +466 -0
  9. package/dist/agents/giuseppe/bot.d.ts +110 -0
  10. package/dist/agents/giuseppe/bot.js +780 -0
  11. package/dist/agents/giuseppe/config.d.ts +25 -0
  12. package/dist/agents/giuseppe/config.js +227 -0
  13. package/dist/agents/giuseppe/files.d.ts +52 -0
  14. package/dist/agents/giuseppe/files.js +338 -0
  15. package/dist/agents/giuseppe/git.d.ts +48 -0
  16. package/dist/agents/giuseppe/git.js +298 -0
  17. package/dist/agents/giuseppe/index.d.ts +97 -0
  18. package/dist/agents/giuseppe/index.js +258 -0
  19. package/dist/agents/giuseppe/lsp.d.ts +113 -0
  20. package/dist/agents/giuseppe/lsp.js +485 -0
  21. package/dist/agents/giuseppe/monitor.d.ts +118 -0
  22. package/dist/agents/giuseppe/monitor.js +621 -0
  23. package/dist/agents/giuseppe/prompt.d.ts +5 -0
  24. package/dist/agents/giuseppe/prompt.js +94 -0
  25. package/dist/agents/giuseppe/registries/pending-classification.d.ts +28 -0
  26. package/dist/agents/giuseppe/registries/pending-classification.js +50 -0
  27. package/dist/agents/giuseppe/registries/pending-fix.d.ts +30 -0
  28. package/dist/agents/giuseppe/registries/pending-fix.js +42 -0
  29. package/dist/agents/giuseppe/registries/pending.d.ts +27 -0
  30. package/dist/agents/giuseppe/registries/pending.js +49 -0
  31. package/dist/agents/giuseppe/specialist.d.ts +47 -0
  32. package/dist/agents/giuseppe/specialist.js +237 -0
  33. package/dist/agents/giuseppe/types.d.ts +123 -0
  34. package/dist/agents/giuseppe/types.js +9 -0
  35. package/dist/agents/hailer-expert/index.d.ts +8 -0
  36. package/dist/agents/hailer-expert/index.js +14 -0
  37. package/dist/agents/hal/daemon.d.ts +142 -0
  38. package/dist/agents/hal/daemon.js +1103 -0
  39. package/dist/agents/hal/definitions.d.ts +55 -0
  40. package/dist/agents/hal/definitions.js +263 -0
  41. package/dist/agents/hal/index.d.ts +3 -0
  42. package/dist/agents/hal/index.js +8 -0
  43. package/dist/agents/index.d.ts +18 -0
  44. package/dist/agents/index.js +48 -0
  45. package/dist/agents/shared/base.d.ts +216 -0
  46. package/dist/agents/shared/base.js +846 -0
  47. package/dist/agents/shared/services/agent-registry.d.ts +107 -0
  48. package/dist/agents/shared/services/agent-registry.js +629 -0
  49. package/dist/agents/shared/services/conversation-manager.d.ts +50 -0
  50. package/dist/agents/shared/services/conversation-manager.js +136 -0
  51. package/dist/agents/shared/services/mcp-client.d.ts +56 -0
  52. package/dist/agents/shared/services/mcp-client.js +124 -0
  53. package/dist/agents/shared/services/message-classifier.d.ts +37 -0
  54. package/dist/agents/shared/services/message-classifier.js +187 -0
  55. package/dist/agents/shared/services/message-formatter.d.ts +89 -0
  56. package/dist/agents/shared/services/message-formatter.js +371 -0
  57. package/dist/agents/shared/services/session-logger.d.ts +106 -0
  58. package/dist/agents/shared/services/session-logger.js +446 -0
  59. package/dist/agents/shared/services/tool-executor.d.ts +41 -0
  60. package/dist/agents/shared/services/tool-executor.js +169 -0
  61. package/dist/agents/shared/services/workspace-schema-cache.d.ts +125 -0
  62. package/dist/agents/shared/services/workspace-schema-cache.js +578 -0
  63. package/dist/agents/shared/specialist.d.ts +91 -0
  64. package/dist/agents/shared/specialist.js +399 -0
  65. package/dist/agents/shared/tool-schema-loader.d.ts +62 -0
  66. package/dist/agents/shared/tool-schema-loader.js +232 -0
  67. package/dist/agents/shared/types.d.ts +327 -0
  68. package/dist/agents/shared/types.js +121 -0
  69. package/dist/app.js +21 -4
  70. package/dist/cli.js +0 -0
  71. package/dist/client/agents/orchestrator.d.ts +1 -0
  72. package/dist/client/agents/orchestrator.js +12 -1
  73. package/dist/commands/seed-config.d.ts +9 -0
  74. package/dist/commands/seed-config.js +372 -0
  75. package/dist/config.d.ts +10 -0
  76. package/dist/config.js +61 -1
  77. package/dist/core.d.ts +8 -0
  78. package/dist/core.js +137 -6
  79. package/dist/lib/discussion-lock.d.ts +42 -0
  80. package/dist/lib/discussion-lock.js +110 -0
  81. package/dist/mcp/UserContextCache.js +2 -2
  82. package/dist/mcp/hailer-clients.d.ts +15 -0
  83. package/dist/mcp/hailer-clients.js +100 -6
  84. package/dist/mcp/signal-handler.d.ts +16 -5
  85. package/dist/mcp/signal-handler.js +173 -122
  86. package/dist/mcp/tools/activity.js +9 -1
  87. package/dist/mcp/tools/bot-config.d.ts +184 -9
  88. package/dist/mcp/tools/bot-config.js +2177 -163
  89. package/dist/mcp/tools/giuseppe-tools.d.ts +21 -0
  90. package/dist/mcp/tools/giuseppe-tools.js +525 -0
  91. package/dist/mcp/utils/hailer-api-client.d.ts +42 -1
  92. package/dist/mcp/utils/hailer-api-client.js +128 -2
  93. package/dist/mcp/webhook-handler.d.ts +87 -0
  94. package/dist/mcp/webhook-handler.js +343 -0
  95. package/dist/mcp/workspace-cache.d.ts +5 -0
  96. package/dist/mcp/workspace-cache.js +11 -0
  97. package/dist/mcp-server.js +55 -5
  98. package/dist/modules/bug-reports/giuseppe-agent.d.ts +58 -0
  99. package/dist/modules/bug-reports/giuseppe-agent.js +467 -0
  100. package/dist/modules/bug-reports/giuseppe-ai.d.ts +25 -1
  101. package/dist/modules/bug-reports/giuseppe-ai.js +133 -2
  102. package/dist/modules/bug-reports/giuseppe-bot.d.ts +2 -2
  103. package/dist/modules/bug-reports/giuseppe-bot.js +66 -42
  104. package/dist/modules/bug-reports/giuseppe-daemon.d.ts +80 -0
  105. package/dist/modules/bug-reports/giuseppe-daemon.js +617 -0
  106. package/dist/modules/bug-reports/giuseppe-files.d.ts +12 -0
  107. package/dist/modules/bug-reports/giuseppe-files.js +37 -0
  108. package/dist/modules/bug-reports/giuseppe-lsp.d.ts +84 -13
  109. package/dist/modules/bug-reports/giuseppe-lsp.js +403 -61
  110. package/dist/modules/bug-reports/index.d.ts +1 -0
  111. package/dist/modules/bug-reports/index.js +31 -29
  112. package/package.json +3 -2
@@ -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,8 @@
1
+ /**
2
+ * HailerExpert Agent
3
+ *
4
+ * Uses the shared SpecialistDaemon with config from hal/definitions.ts
5
+ * No custom daemon class needed - all config is in SPECIALISTS.hailerExpert
6
+ */
7
+ export { SPECIALISTS } from '../hal/definitions';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /**
3
+ * HailerExpert Agent
4
+ *
5
+ * Uses the shared SpecialistDaemon with config from hal/definitions.ts
6
+ * No custom daemon class needed - all config is in SPECIALISTS.hailerExpert
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.SPECIALISTS = void 0;
10
+ // Re-export from definitions for convenience
11
+ var definitions_1 = require("../hal/definitions");
12
+ Object.defineProperty(exports, "SPECIALISTS", { enumerable: true, get: function () { return definitions_1.SPECIALISTS; } });
13
+ // HailerExpert uses SpecialistDaemon directly - no custom class
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Orchestrator Daemon (HAL)
3
+ *
4
+ * The main conversational bot that handles general chat and coordinates
5
+ * with specialist bots when tasks are too complex.
6
+ *
7
+ * HAL can:
8
+ * - Handle general conversation and simple queries
9
+ * - Detect when a task needs specialist help
10
+ * - Invite specialist bots to the discussion
11
+ * - Hand off context to specialists
12
+ * - Summarize specialist responses for users
13
+ */
14
+ import { ChatAgentDaemon, ChatAgentDaemonConfig, IncomingMessage } from "../shared/base";
15
+ import { HailerSignal } from "../../mcp/signal-handler";
16
+ import { ToolInput } from "../shared/types";
17
+ import Anthropic from "@anthropic-ai/sdk";
18
+ export interface OrchestratorDaemonConfig extends ChatAgentDaemonConfig {
19
+ /** Map of specialist key to their Hailer user ID */
20
+ specialistUserIds?: Map<string, string>;
21
+ }
22
+ export declare class OrchestratorDaemon extends ChatAgentDaemon {
23
+ private orchestratorLogger;
24
+ private specialists;
25
+ private activeSpecialistsInDiscussion;
26
+ private specialistUserIds;
27
+ private toolsUsedInCurrentMessage;
28
+ private lastToolsUsed;
29
+ private lastToolsFailed;
30
+ private static SILENT_SUCCESS_TOOLS;
31
+ private lastKnownActivityId;
32
+ private lastKnownActivityName;
33
+ private lastKnownActivityTime;
34
+ private static CONTEXT_MEMORY_TIMEOUT;
35
+ constructor(config: OrchestratorDaemonConfig);
36
+ /**
37
+ * Trigger HAL to respond in a discussion with specific context
38
+ * Used when bug monitor needs HAL to naturally inform users about Giuseppe being disabled
39
+ */
40
+ respondWithContext(discussionId: string, activityId: string, contextMessage: string): Promise<void>;
41
+ /**
42
+ * Override agent name for Agent Directory
43
+ * Uses the actual Hailer user name from BotClient (set in workspace)
44
+ */
45
+ protected getAgentName(): {
46
+ firstName: string;
47
+ lastName: string;
48
+ };
49
+ /**
50
+ * Override agent description for Agent Directory
51
+ */
52
+ protected getAgentDescription(): string;
53
+ /**
54
+ * Override Position details for Orchestrator
55
+ */
56
+ protected getPositionDetails(): {
57
+ name: string;
58
+ purpose: string;
59
+ personaTone: string;
60
+ coreCapabilities: string;
61
+ boundaries: string;
62
+ };
63
+ /**
64
+ * Orchestrator only needs basic tools - complex ops go to specialists
65
+ */
66
+ protected getToolWhitelist(): string[];
67
+ /**
68
+ * Preprocess tool input - inject context for certain tools
69
+ * Uses cross-discussion memory to maintain context awareness
70
+ */
71
+ protected preprocessToolInput(toolName: string, input: ToolInput): ToolInput;
72
+ /**
73
+ * Override to detect tool failures for silent success feature
74
+ */
75
+ protected executeToolsAndContinue(toolUseBlocks: Anthropic.ToolUseBlock[], originalMessage: IncomingMessage): Promise<void>;
76
+ /**
77
+ * Update cross-discussion memory when processing messages
78
+ * Call this when entering an activity discussion to remember context
79
+ */
80
+ private updateContextMemory;
81
+ /**
82
+ * Override to update cross-discussion memory when entering activity discussions
83
+ */
84
+ protected extractIncomingMessage(signal: HailerSignal): Promise<IncomingMessage | null>;
85
+ /**
86
+ * Register a specialist's Hailer user ID
87
+ * Called during initialization when we know the specialist bot's user ID
88
+ */
89
+ registerSpecialistUserId(specialistKey: string, userId: string, displayName?: string): void;
90
+ /**
91
+ * Unregister a specialist (called when specialist is disabled/stopped)
92
+ * This prevents HAL from trying to invite a disabled specialist
93
+ */
94
+ unregisterSpecialist(specialistKey: string): void;
95
+ /**
96
+ * Mark a specialist as active in a discussion
97
+ */
98
+ private markSpecialistActive;
99
+ /**
100
+ * Invite a specialist to a discussion
101
+ * Always invites first (tool handles membership check), then tags
102
+ */
103
+ private inviteSpecialist;
104
+ /**
105
+ * Override getTools to include Giuseppe retry tool when there's a pending fix
106
+ */
107
+ protected getTools(): Anthropic.Tool[];
108
+ /**
109
+ * Get tools list with Giuseppe retry tool added
110
+ */
111
+ private getToolsWithGiuseppeRetry;
112
+ /**
113
+ * Get pending fix context for a discussion (if any)
114
+ */
115
+ private getPendingFixContext;
116
+ /**
117
+ * Get pending classification context for a discussion (if any)
118
+ */
119
+ private getPendingClassificationContext;
120
+ /**
121
+ * Override system prompt to include orchestrator capabilities
122
+ */
123
+ protected getSystemPrompt(): string;
124
+ /**
125
+ * Override response handling to detect specialist invitations
126
+ */
127
+ protected handleLlmResponse(response: Anthropic.Message, originalMessage: IncomingMessage): Promise<void>;
128
+ /**
129
+ * Get orchestrator status including specialist info
130
+ */
131
+ getOrchestratorStatus(): {
132
+ conversationState: ReturnType<ChatAgentDaemon["getConversationState"]>;
133
+ specialists: Array<{
134
+ key: string;
135
+ name: string;
136
+ available: boolean;
137
+ userId?: string;
138
+ }>;
139
+ activeInDiscussions: Record<string, string[]>;
140
+ };
141
+ }
142
+ //# sourceMappingURL=daemon.d.ts.map