edsger 0.28.1 → 0.28.2

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.
@@ -62,12 +62,32 @@ export async function processHumanMessages(messages, featureId, config, verbose)
62
62
  return `[Message ${i + 1} from ${m.sender_name}]: ${m.content}`;
63
63
  });
64
64
  const userPrompt = messageParts.join('\n\n');
65
- // On first message: include full context so the session starts informed
66
- // On resume: just send the new message — the session already has context
65
+ // On first message: include full context + chat history so the session
66
+ // starts informed (covers CLI restart where in-memory session is lost).
67
+ // On resume: just send the new message — the session already has context.
67
68
  let fullPrompt;
68
69
  if (!existingSessionId) {
69
70
  const context = await buildChatContext(featureId, channelId, verbose);
70
71
  const contextStr = formatContextForAI(context);
72
+ // Load recent chat history so the AI has conversational continuity
73
+ const recentMessages = await listChatMessages(channelId, { limit: 30 }, verbose);
74
+ // Exclude the messages we're about to process (they'll be in userPrompt)
75
+ const currentIds = new Set(messages.map((m) => m.id));
76
+ const historyMessages = recentMessages.filter((m) => !currentIds.has(m.id));
77
+ let historySection = '';
78
+ if (historyMessages.length > 0) {
79
+ const historyLines = historyMessages.map((m) => {
80
+ const role = m.sender_type === 'ai' ? 'AI' : m.sender_type === 'system' ? 'System' : (m.sender_name || 'User');
81
+ return `[${role}]: ${m.content}`;
82
+ });
83
+ historySection = [
84
+ `## Previous Chat History`,
85
+ `The following is the recent conversation history in this channel. Continue the conversation naturally.`,
86
+ '',
87
+ ...historyLines,
88
+ '',
89
+ ].join('\n');
90
+ }
71
91
  fullPrompt = [
72
92
  `## Current Feature Context`,
73
93
  contextStr,
@@ -75,6 +95,7 @@ export async function processHumanMessages(messages, featureId, config, verbose)
75
95
  `## Channel ID: ${channelId}`,
76
96
  `## Feature ID: ${featureId}`,
77
97
  '',
98
+ historySection,
78
99
  `## Human Message`,
79
100
  userPrompt,
80
101
  '',
@@ -8,7 +8,7 @@
8
8
  import { createSdkMcpServer, tool } from '@anthropic-ai/claude-agent-sdk';
9
9
  import { z } from 'zod';
10
10
  import { callMcpEndpoint } from '../../api/mcp-client.js';
11
- import { sendAiMessage } from '../../api/chat.js';
11
+ import { sendAiMessage, listChatMessages } from '../../api/chat.js';
12
12
  /**
13
13
  * Create an in-process MCP server with chat-specific tools.
14
14
  * Pass the returned config to query() options.mcpServers.
@@ -241,6 +241,36 @@ export function createChatMcpServer() {
241
241
  ],
242
242
  };
243
243
  }),
244
+ tool('get_chat_history', 'Retrieve older chat messages from the channel. Use this when you need more context about what was discussed earlier — for example, to understand referenced bugs, prior decisions, or feedback the user gave in earlier messages.', {
245
+ channel_id: z.string().describe('Chat channel ID'),
246
+ limit: z
247
+ .number()
248
+ .optional()
249
+ .describe('Number of messages to retrieve (default 50, max 100)'),
250
+ before: z
251
+ .string()
252
+ .optional()
253
+ .describe('Fetch messages before this ISO timestamp for pagination'),
254
+ }, async (args) => {
255
+ const limit = Math.min(args.limit || 50, 100);
256
+ const messages = await listChatMessages(args.channel_id, { limit, ...(args.before ? { since: args.before } : {}) });
257
+ const formatted = messages.map((m) => ({
258
+ id: m.id,
259
+ sender: m.sender_type === 'ai' ? 'AI' : m.sender_type === 'system' ? 'System' : (m.sender_name || 'User'),
260
+ sender_type: m.sender_type,
261
+ content: m.content,
262
+ message_type: m.message_type,
263
+ created_at: m.created_at,
264
+ }));
265
+ return {
266
+ content: [
267
+ {
268
+ type: 'text',
269
+ text: JSON.stringify({ messages: formatted, count: formatted.length }, null, 2),
270
+ },
271
+ ],
272
+ };
273
+ }),
244
274
  tool('trigger_phase_rerun', 'Reset a workflow phase to pending so it will re-run.', {
245
275
  feature_id: z.string().describe('Feature ID'),
246
276
  phase: z.string().describe('Phase name to reset'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edsger",
3
- "version": "0.28.1",
3
+ "version": "0.28.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "edsger": "dist/index.js"