codeep 1.2.28 → 1.2.30

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.
@@ -66,6 +66,10 @@ export function initWorkspace(workspaceRoot) {
66
66
  '',
67
67
  'Type `/help` to see available commands.',
68
68
  ];
69
+ if (history.length > 0) {
70
+ lines.push('', '---', '');
71
+ lines.push(...formatSessionPreviewLines(history));
72
+ }
69
73
  return { codeepSessionId, history, welcomeText: lines.join('\n') };
70
74
  }
71
75
  // ─── Command dispatch ─────────────────────────────────────────────────────────
@@ -109,11 +113,13 @@ export function handleCommand(input, session) {
109
113
  }
110
114
  return { handled: true, response: loginCmd(providerId, apiKey) };
111
115
  }
112
- case 'sessions': {
113
- return { handled: true, response: buildSessionList(session.workspaceRoot) };
114
- }
116
+ case 'sessions':
115
117
  case 'session': {
116
118
  const sub = args[0];
119
+ if (!sub) {
120
+ // No argument — show list with usage hint
121
+ return { handled: true, response: buildSessionList(session.workspaceRoot) };
122
+ }
117
123
  if (sub === 'new') {
118
124
  const id = startNewSession();
119
125
  session.codeepSessionId = id;
@@ -125,11 +131,11 @@ export function handleCommand(input, session) {
125
131
  if (loaded) {
126
132
  session.codeepSessionId = args[1];
127
133
  session.history = loaded;
128
- return { handled: true, response: `Session loaded: \`${args[1]}\` (${session.history.length} messages)` };
134
+ return { handled: true, response: formatSessionPreview(args[1], session.history) };
129
135
  }
130
136
  return { handled: true, response: `Session not found: \`${args[1]}\`` };
131
137
  }
132
- return { handled: true, response: 'Usage: `/session new` or `/session load <name>`' };
138
+ return { handled: true, response: 'Usage: `/session` · `/session new` · `/session load <name>`' };
133
139
  }
134
140
  case 'save': {
135
141
  const name = args.length ? args.join('-') : session.codeepSessionId;
@@ -176,7 +182,7 @@ function buildHelp() {
176
182
  '| `/login <providerId> <apiKey>` | Set API key for a provider |',
177
183
  '| `/apikey` | Show masked API key for current provider |',
178
184
  '| `/apikey <key>` | Set API key for current provider |',
179
- '| `/sessions` | List saved sessions |',
185
+ '| `/session` | List saved sessions |',
180
186
  '| `/session new` | Start a new session |',
181
187
  '| `/session load <name>` | Load a saved session |',
182
188
  '| `/save [name]` | Save current session |',
@@ -259,6 +265,31 @@ function loginCmd(providerId, apiKey) {
259
265
  setApiKey(apiKey, providerId);
260
266
  return `Logged in as **${provider.name}** (\`${providerId}\`). Model: \`${provider.defaultModel}\`.`;
261
267
  }
268
+ const PREVIEW_MESSAGES = 6; // last N messages to show on session restore
269
+ const PREVIEW_MAX_CHARS = 300; // truncate long messages
270
+ function formatSessionPreviewLines(history) {
271
+ const recent = history.slice(-PREVIEW_MESSAGES);
272
+ const lines = [`*Last ${recent.length} message${recent.length !== 1 ? 's' : ''}:*`, ''];
273
+ for (const msg of recent) {
274
+ const role = msg.role === 'user' ? '**You**' : msg.role === 'assistant' ? '**Codeep**' : '_system_';
275
+ const text = msg.content.length > PREVIEW_MAX_CHARS
276
+ ? msg.content.slice(0, PREVIEW_MAX_CHARS) + '…'
277
+ : msg.content;
278
+ // Collapse newlines to keep preview compact
279
+ lines.push(`${role}: ${text.replace(/\n+/g, ' ')}`);
280
+ }
281
+ return lines;
282
+ }
283
+ function formatSessionPreview(name, history) {
284
+ const lines = [
285
+ `Session loaded: \`${name}\` (${history.length} messages)`,
286
+ '',
287
+ '---',
288
+ '',
289
+ ...formatSessionPreviewLines(history),
290
+ ];
291
+ return lines.join('\n');
292
+ }
262
293
  function buildSessionList(workspaceRoot) {
263
294
  const sessions = listSessionsWithInfo(workspaceRoot);
264
295
  if (sessions.length === 0)
@@ -59,6 +59,26 @@ export function startAcpServer() {
59
59
  abortController: null,
60
60
  });
61
61
  transport.respond(msg.id, { sessionId: acpSessionId });
62
+ // Advertise available slash commands to Zed
63
+ transport.notify('session/update', {
64
+ sessionId: acpSessionId,
65
+ update: {
66
+ sessionUpdate: 'available_commands_update',
67
+ availableCommands: [
68
+ { name: 'help', description: 'Show available commands' },
69
+ { name: 'status', description: 'Show current configuration and session info' },
70
+ { name: 'version', description: 'Show version and current model' },
71
+ { name: 'provider', description: 'List or switch AI provider', input: { hint: '<provider-id>' } },
72
+ { name: 'model', description: 'List or switch model', input: { hint: '<model-id>' } },
73
+ { name: 'login', description: 'Set API key for a provider', input: { hint: '<providerId> <apiKey>' } },
74
+ { name: 'apikey', description: 'Show or set API key for current provider', input: { hint: '<key>' } },
75
+ { name: 'session', description: 'List sessions, or: new / load <name>', input: { hint: 'new | load <name>' } },
76
+ { name: 'save', description: 'Save current session', input: { hint: '[name]' } },
77
+ { name: 'grant', description: 'Grant write access for current workspace' },
78
+ { name: 'lang', description: 'Set response language', input: { hint: '<code> (e.g. en, hr, auto)' } },
79
+ ],
80
+ },
81
+ });
62
82
  // Stream welcome message so the client sees it immediately after session/new
63
83
  transport.notify('session/update', {
64
84
  sessionId: acpSessionId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.2.28",
3
+ "version": "1.2.30",
4
4
  "description": "AI-powered coding assistant built for the terminal. Multiple LLM providers, project-aware context, and a seamless development workflow.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",