@agi-cli/server 0.1.147 → 0.1.148

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agi-cli/server",
3
- "version": "0.1.147",
3
+ "version": "0.1.148",
4
4
  "description": "HTTP API server for AGI CLI",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -29,8 +29,8 @@
29
29
  "typecheck": "tsc --noEmit"
30
30
  },
31
31
  "dependencies": {
32
- "@agi-cli/sdk": "0.1.147",
33
- "@agi-cli/database": "0.1.147",
32
+ "@agi-cli/sdk": "0.1.148",
33
+ "@agi-cli/database": "0.1.148",
34
34
  "drizzle-orm": "^0.44.5",
35
35
  "hono": "^4.9.9",
36
36
  "zod": "^4.1.8"
@@ -8,7 +8,7 @@ import {
8
8
  messageParts,
9
9
  shares,
10
10
  } from '@agi-cli/database/schema';
11
- import { desc, eq, and, ne, inArray } from 'drizzle-orm';
11
+ import { desc, eq, and, ne, inArray, or } from 'drizzle-orm';
12
12
  import type { ProviderId } from '@agi-cli/sdk';
13
13
  import { isProviderId, catalog } from '@agi-cli/sdk';
14
14
  import { resolveAgentConfig } from '../runtime/agent/registry.ts';
@@ -745,10 +745,21 @@ export function registerSessionsRoutes(app: Hono) {
745
745
  return c.json({ error: 'Session not found' }, 404);
746
746
  }
747
747
 
748
- // Delete existing message parts (the error content)
748
+ // Delete only error parts - preserve valid text/tool content
749
749
  await db
750
750
  .delete(messageParts)
751
- .where(eq(messageParts.messageId, messageId));
751
+ .where(
752
+ and(
753
+ eq(messageParts.messageId, messageId),
754
+ or(
755
+ eq(messageParts.type, 'error'),
756
+ and(
757
+ eq(messageParts.type, 'tool_call'),
758
+ eq(messageParts.toolName, 'finish'),
759
+ ),
760
+ ),
761
+ ),
762
+ );
752
763
 
753
764
  // Reset message status to pending
754
765
  await db