You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/App.stories.tsx
+75-6Lines changed: 75 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -611,29 +611,98 @@ export const ActiveWorkspaceWithChat: Story = {
611
611
},
612
612
});
613
613
614
-
// Assistant message with file edit
614
+
// Assistant message with file edit (large diff)
615
615
callback({
616
616
id: "msg-4",
617
617
role: "assistant",
618
618
parts: [
619
619
{
620
620
type: "text",
621
-
text: "I'll add JWT token validation to the endpoint. Let me update the file.",
621
+
text: "I'll add JWT token validation to the endpoint. Let me update the file with proper authentication middleware and error handling.",
622
622
},
623
623
{
624
624
type: "dynamic-tool",
625
625
toolCallId: "call-2",
626
-
toolName: "search_replace",
626
+
toolName: "file_edit_replace_string",
627
627
state: "output-available",
628
628
input: {
629
629
file_path: "src/api/users.ts",
630
-
old_string: "export function getUser(req, res) {",
630
+
old_string:
631
+
"import express from 'express';\nimport { db } from '../db';\n\nexport function getUser(req, res) {\n const user = db.users.find(req.params.id);\n res.json(user);\n}",
631
632
new_string:
632
-
"import { verifyToken } from '../auth/jwt';\n\nexport function getUser(req, res) {\n const token = req.headers.authorization?.split(' ')[1];\n if (!token || !verifyToken(token)) {\n return res.status(401).json({ error: 'Unauthorized' });\n }",
633
+
"import express from 'express';\nimport { db } from '../db';\nimport { verifyToken } from '../auth/jwt';\nimport { logger } from '../utils/logger';\n\nexport async function getUser(req, res) {\n try {\n const token = req.headers.authorization?.split(' ')[1];\n if (!token) {\n logger.warn('Missing authorization token');\n return res.status(401).json({ error: 'Unauthorized' });\n }\n const decoded = await verifyToken(token);\n const user = await db.users.find(req.params.id);\n res.json(user);\n } catch (err) {\n logger.error('Auth error:', err);\n return res.status(401).json({ error: 'Invalid token' });\n }\n}",
633
634
},
634
635
output: {
635
636
success: true,
636
-
message: "File updated successfully",
637
+
diff: [
638
+
"--- src/api/users.ts",
639
+
"+++ src/api/users.ts",
640
+
"@@ -2,0 +3,2 @@",
641
+
"+import { verifyToken } from '../auth/jwt';",
642
+
"+import { logger } from '../utils/logger';",
643
+
"@@ -4,28 +6,14 @@",
644
+
"-// TODO: Add authentication middleware",
645
+
"-// Current implementation is insecure and allows unauthorized access",
646
+
"-// Need to validate JWT tokens before processing requests",
647
+
"-// Also need to add rate limiting to prevent abuse",
648
+
"-// Consider adding request logging for audit trail",
649
+
"-// Add input validation for user IDs",
650
+
"-// Handle edge cases for deleted/suspended users",
0 commit comments