tarsk 0.2.5 → 0.3.0
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/README.md +1 -7
- package/dist/index.d.ts +3 -0
- package/dist/index.js +92 -32
- package/dist/lib/response-builder.d.ts +50 -0
- package/dist/lib/response-builder.js +56 -0
- package/dist/lib/stream-helper.d.ts +39 -0
- package/dist/lib/stream-helper.js +43 -0
- package/dist/managers/ConversationManager.d.ts +83 -0
- package/dist/managers/ConversationManager.js +129 -0
- package/dist/managers/GitManager.d.ts +133 -0
- package/dist/managers/GitManager.js +330 -0
- package/dist/managers/MetadataManager.d.ts +139 -0
- package/dist/managers/MetadataManager.js +309 -0
- package/dist/managers/ModelManager.d.ts +57 -0
- package/dist/managers/ModelManager.js +129 -0
- package/dist/managers/NeovateExecutor.d.ts +40 -0
- package/dist/managers/NeovateExecutor.js +138 -0
- package/dist/managers/ProjectManager.d.ts +162 -0
- package/dist/managers/ProjectManager.js +353 -0
- package/dist/managers/ThreadManager.d.ts +181 -0
- package/dist/managers/ThreadManager.js +325 -0
- package/dist/managers/conversation-manager.d.ts +83 -0
- package/dist/managers/conversation-manager.js +129 -0
- package/dist/managers/git-manager.d.ts +133 -0
- package/dist/managers/git-manager.js +330 -0
- package/dist/managers/metadata-manager.d.ts +139 -0
- package/dist/managers/metadata-manager.js +305 -0
- package/dist/managers/model-manager.d.ts +59 -0
- package/dist/managers/model-manager.js +144 -0
- package/dist/managers/neovate-executor.d.ts +43 -0
- package/dist/managers/neovate-executor.js +205 -0
- package/dist/managers/processing-state-manager.d.ts +40 -0
- package/dist/managers/processing-state-manager.js +27 -0
- package/dist/managers/project-manager.d.ts +199 -0
- package/dist/managers/project-manager.js +465 -0
- package/dist/managers/thread-manager.d.ts +193 -0
- package/dist/managers/thread-manager.js +368 -0
- package/dist/model-info-aihubmix.d.ts +25 -0
- package/dist/model-info-aihubmix.js +117 -0
- package/dist/model-info-openai.d.ts +17 -0
- package/dist/model-info-openai.js +59 -0
- package/dist/model-info-openrouter.d.ts +25 -0
- package/dist/model-info-openrouter.js +101 -0
- package/dist/model-info.d.ts +37 -0
- package/dist/model-info.js +39 -0
- package/dist/provider-data.d.ts +101 -0
- package/dist/provider-data.js +471 -0
- package/dist/provider.d.ts +10 -0
- package/dist/provider.js +192 -0
- package/dist/public/android-chrome-192x192.png +0 -0
- package/dist/public/android-chrome-512x512.png +0 -0
- package/dist/public/apple-touch-icon.png +0 -0
- package/dist/public/assets/index-B443aj9k.js +8506 -0
- package/dist/public/assets/index-CjXGVbI7.css +1 -0
- package/dist/public/assets/index-DJC-p914.js +8506 -0
- package/dist/public/favicon-16x16.png +0 -0
- package/dist/public/favicon-32x32.png +0 -0
- package/dist/public/favicon.ico +0 -0
- package/dist/public/index.html +28 -0
- package/dist/public/manifest.json +82 -0
- package/dist/public/placeholder-logo.svg +1 -0
- package/dist/public/placeholder.svg +1 -0
- package/dist/public/snpro.woff2 +0 -0
- package/dist/public/tarsk-color.svg +12 -0
- package/dist/public/tarsk.png +0 -0
- package/dist/public/tarsk.svg +12 -0
- package/dist/public/zalando-sans.woff2 +0 -0
- package/dist/routes/chat-old.d.ts +21 -0
- package/dist/routes/chat-old.js +251 -0
- package/dist/routes/chat.d.ts +21 -0
- package/dist/routes/chat.js +217 -0
- package/dist/routes/git.d.ts +4 -0
- package/dist/routes/git.js +668 -0
- package/dist/routes/models.d.ts +18 -0
- package/dist/routes/models.js +128 -0
- package/dist/routes/projects-old.d.ts +20 -0
- package/dist/routes/projects-old.js +297 -0
- package/dist/routes/projects.d.ts +20 -0
- package/dist/routes/projects.js +365 -0
- package/dist/routes/providers.d.ts +15 -0
- package/dist/routes/providers.js +130 -0
- package/dist/routes/threads-old.d.ts +14 -0
- package/dist/routes/threads-old.js +393 -0
- package/dist/routes/threads.d.ts +14 -0
- package/dist/routes/threads.js +352 -0
- package/dist/types/models.d.ts +315 -0
- package/dist/types/models.js +11 -0
- package/dist/utils/env-manager.d.ts +3 -0
- package/dist/utils/env-manager.js +60 -0
- package/dist/utils/open-router-models.d.ts +45 -0
- package/dist/utils/open-router-models.js +103 -0
- package/dist/utils/openai-models.d.ts +63 -0
- package/dist/utils/openai-models.js +152 -0
- package/dist/utils/openai-pricing-scraper.d.ts +17 -0
- package/dist/utils/openai-pricing-scraper.js +185 -0
- package/dist/utils/validation.d.ts +10 -0
- package/dist/utils/validation.js +20 -0
- package/dist/utils.d.ts +10 -0
- package/dist/utils.js +12 -0
- package/package.json +36 -22
- package/LICENSE.md +0 -7
- package/dist/agent/agent.js +0 -131
- package/dist/agent/interfaces.js +0 -1
- package/dist/api/encryption.js +0 -41
- package/dist/api/models.js +0 -169
- package/dist/api/prompt.js +0 -12
- package/dist/api/settings.js +0 -43
- package/dist/api/test.js +0 -29
- package/dist/api/tools.js +0 -287
- package/dist/api/utils.js +0 -18
- package/dist/interfaces/meta.js +0 -1
- package/dist/interfaces/model.js +0 -1
- package/dist/interfaces/settings.js +0 -1
- package/dist/log/log.js +0 -33
- package/dist/prompt.js +0 -49
- package/dist/tools.js +0 -84
- package/dist/utils/files.js +0 -14
- package/dist/utils/json-file.js +0 -28
- package/dist/utils/strip-markdown.js +0 -5
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<!-- Favicon and PWA Icons -->
|
|
6
|
+
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
|
7
|
+
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
|
|
8
|
+
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
|
|
9
|
+
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
|
10
|
+
<link rel="manifest" href="/manifest.json" />
|
|
11
|
+
|
|
12
|
+
<!-- Meta Tags -->
|
|
13
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
14
|
+
<meta name="theme-color" content="#000000" />
|
|
15
|
+
<meta name="description" content="Manage projects and conversation threads with AI agents" />
|
|
16
|
+
<meta name="mobile-web-app-capable" content="yes" />
|
|
17
|
+
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
18
|
+
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
|
19
|
+
<meta name="apple-mobile-web-app-title" content="Tarsk" />
|
|
20
|
+
|
|
21
|
+
<title>Tarsk</title>
|
|
22
|
+
<script type="module" crossorigin src="/assets/index-DJC-p914.js"></script>
|
|
23
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CjXGVbI7.css">
|
|
24
|
+
</head>
|
|
25
|
+
<body class="font-sans antialiased">
|
|
26
|
+
<div id="root"></div>
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Tarsk - Coding Agent",
|
|
3
|
+
"short_name": "Tarsk",
|
|
4
|
+
"description": "A coding agent to manage multiple projects",
|
|
5
|
+
"start_url": "/",
|
|
6
|
+
"scope": "/",
|
|
7
|
+
"display": "standalone",
|
|
8
|
+
"orientation": "portrait-primary",
|
|
9
|
+
"theme_color": "#000000",
|
|
10
|
+
"background_color": "#ffffff",
|
|
11
|
+
"icons": [
|
|
12
|
+
{
|
|
13
|
+
"src": "/favicon-16x16.png",
|
|
14
|
+
"sizes": "16x16",
|
|
15
|
+
"type": "image/png"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"src": "/favicon-32x32.png",
|
|
19
|
+
"sizes": "32x32",
|
|
20
|
+
"type": "image/png"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"src": "/apple-touch-icon.png",
|
|
24
|
+
"sizes": "180x180",
|
|
25
|
+
"type": "image/png"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"src": "/android-chrome-192x192.png",
|
|
29
|
+
"sizes": "192x192",
|
|
30
|
+
"type": "image/png",
|
|
31
|
+
"purpose": "any"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"src": "/android-chrome-192x192.png",
|
|
35
|
+
"sizes": "192x192",
|
|
36
|
+
"type": "image/png",
|
|
37
|
+
"purpose": "maskable"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"src": "/android-chrome-512x512.png",
|
|
41
|
+
"sizes": "512x512",
|
|
42
|
+
"type": "image/png",
|
|
43
|
+
"purpose": "any"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"src": "/android-chrome-512x512.png",
|
|
47
|
+
"sizes": "512x512",
|
|
48
|
+
"type": "image/png",
|
|
49
|
+
"purpose": "maskable"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"screenshots": [
|
|
53
|
+
{
|
|
54
|
+
"src": "/android-chrome-512x512.png",
|
|
55
|
+
"sizes": "512x512",
|
|
56
|
+
"type": "image/png",
|
|
57
|
+
"form_factor": "wide"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"src": "/android-chrome-192x192.png",
|
|
61
|
+
"sizes": "192x192",
|
|
62
|
+
"type": "image/png",
|
|
63
|
+
"form_factor": "narrow"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"categories": ["productivity"],
|
|
67
|
+
"shortcuts": [
|
|
68
|
+
{
|
|
69
|
+
"name": "Create New Project",
|
|
70
|
+
"short_name": "New Project",
|
|
71
|
+
"description": "Create a new project",
|
|
72
|
+
"url": "/?action=new-project",
|
|
73
|
+
"icons": [
|
|
74
|
+
{
|
|
75
|
+
"src": "/android-chrome-192x192.png",
|
|
76
|
+
"sizes": "192x192",
|
|
77
|
+
"type": "image/png"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="215" height="48" fill="none"><path fill="#000" d="M57.588 9.6h6L73.828 38h-5.2l-2.36-6.88h-11.36L52.548 38h-5.2l10.24-28.4Zm7.16 17.16-4.16-12.16-4.16 12.16h8.32Zm23.694-2.24c-.186-1.307-.706-2.32-1.56-3.04-.853-.72-1.866-1.08-3.04-1.08-1.68 0-2.986.613-3.92 1.84-.906 1.227-1.36 2.947-1.36 5.16s.454 3.933 1.36 5.16c.934 1.227 2.24 1.84 3.92 1.84 1.254 0 2.307-.373 3.16-1.12.854-.773 1.387-1.867 1.6-3.28l5.12.24c-.186 1.68-.733 3.147-1.64 4.4-.906 1.227-2.08 2.173-3.52 2.84-1.413.667-2.986 1-4.72 1-2.08 0-3.906-.453-5.48-1.36-1.546-.907-2.76-2.2-3.64-3.88-.853-1.68-1.28-3.627-1.28-5.84 0-2.24.427-4.187 1.28-5.84.88-1.68 2.094-2.973 3.64-3.88 1.574-.907 3.4-1.36 5.48-1.36 1.68 0 3.227.32 4.64.96 1.414.64 2.56 1.56 3.44 2.76.907 1.2 1.454 2.6 1.64 4.2l-5.12.28Zm11.486-7.72.12 3.4c.534-1.227 1.307-2.173 2.32-2.84 1.04-.693 2.267-1.04 3.68-1.04 1.494 0 2.76.387 3.8 1.16 1.067.747 1.827 1.813 2.28 3.2.507-1.44 1.294-2.52 2.36-3.24 1.094-.747 2.414-1.12 3.96-1.12 1.414 0 2.64.307 3.68.92s1.84 1.52 2.4 2.72c.56 1.2.84 2.667.84 4.4V38h-4.96V25.92c0-1.813-.293-3.187-.88-4.12-.56-.96-1.413-1.44-2.56-1.44-.906 0-1.68.213-2.32.64-.64.427-1.133 1.053-1.48 1.88-.32.827-.48 1.84-.48 3.04V38h-4.56V25.92c0-1.2-.133-2.213-.4-3.04-.24-.827-.626-1.453-1.16-1.88-.506-.427-1.133-.64-1.88-.64-.906 0-1.68.227-2.32.68-.64.427-1.133 1.053-1.48 1.88-.32.827-.48 1.827-.48 3V38h-4.96V16.8h4.48Zm26.723 10.6c0-2.24.427-4.187 1.28-5.84.854-1.68 2.067-2.973 3.64-3.88 1.574-.907 3.4-1.36 5.48-1.36 1.84 0 3.494.413 4.96 1.24 1.467.827 2.64 2.08 3.52 3.76.88 1.653 1.347 3.693 1.4 6.12v1.32h-15.08c.107 1.813.614 3.227 1.52 4.24.907.987 2.134 1.48 3.68 1.48.987 0 1.88-.253 2.68-.76a4.803 4.803 0 0 0 1.84-2.2l5.08.36c-.64 2.027-1.84 3.64-3.6 4.84-1.733 1.173-3.733 1.76-6 1.76-2.08 0-3.906-.453-5.48-1.36-1.573-.907-2.786-2.2-3.64-3.88-.853-1.68-1.28-3.627-1.28-5.84Zm15.16-2.04c-.213-1.733-.76-3.013-1.64-3.84-.853-.827-1.893-1.24-3.12-1.24-1.44 0-2.6.453-3.48 1.36-.88.88-1.44 2.12-1.68 3.72h9.92ZM163.139 9.6V38h-5.04V9.6h5.04Zm8.322 7.2.24 5.88-.64-.36c.32-2.053 1.094-3.56 2.32-4.52 1.254-.987 2.787-1.48 4.6-1.48 2.32 0 4.107.733 5.36 2.2 1.254 1.44 1.88 3.387 1.88 5.84V38h-4.96V25.92c0-1.253-.12-2.28-.36-3.08-.24-.8-.64-1.413-1.2-1.84-.533-.427-1.253-.64-2.16-.64-1.44 0-2.573.48-3.4 1.44-.8.933-1.2 2.307-1.2 4.12V38h-4.96V16.8h4.48Zm30.003 7.72c-.186-1.307-.706-2.32-1.56-3.04-.853-.72-1.866-1.08-3.04-1.08-1.68 0-2.986.613-3.92 1.84-.906 1.227-1.36 2.947-1.36 5.16s.454 3.933 1.36 5.16c.934 1.227 2.24 1.84 3.92 1.84 1.254 0 2.307-.373 3.16-1.12.854-.773 1.387-1.867 1.6-3.28l5.12.24c-.186 1.68-.733 3.147-1.64 4.4-.906 1.227-2.08 2.173-3.52 2.84-1.413.667-2.986 1-4.72 1-2.08 0-3.906-.453-5.48-1.36-1.546-.907-2.76-2.2-3.64-3.88-.853-1.68-1.28-3.627-1.28-5.84 0-2.24.427-4.187 1.28-5.84.88-1.68 2.094-2.973 3.64-3.88 1.574-.907 3.4-1.36 5.48-1.36 1.68 0 3.227.32 4.64.96 1.414.64 2.56 1.56 3.44 2.76.907 1.2 1.454 2.6 1.64 4.2l-5.12.28Zm11.443 8.16V38h-5.6v-5.32h5.6Z"/><path fill="#171717" fill-rule="evenodd" d="m7.839 40.783 16.03-28.054L20 6 0 40.783h7.839Zm8.214 0H40L27.99 19.894l-4.02 7.032 3.976 6.914H20.02l-3.967 6.943Z" clip-rule="evenodd"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="1200" fill="none"><rect width="1200" height="1200" fill="#EAEAEA" rx="3"/><g opacity=".5"><g opacity=".5"><path fill="#FAFAFA" d="M600.709 736.5c-75.454 0-136.621-61.167-136.621-136.62 0-75.454 61.167-136.621 136.621-136.621 75.453 0 136.62 61.167 136.62 136.621 0 75.453-61.167 136.62-136.62 136.62Z"/><path stroke="#C9C9C9" stroke-width="2.418" d="M600.709 736.5c-75.454 0-136.621-61.167-136.621-136.62 0-75.454 61.167-136.621 136.621-136.621 75.453 0 136.62 61.167 136.62 136.621 0 75.453-61.167 136.62-136.62 136.62Z"/></g><path stroke="url(#a)" stroke-width="2.418" d="M0-1.209h553.581" transform="scale(1 -1) rotate(45 1163.11 91.165)"/><path stroke="url(#b)" stroke-width="2.418" d="M404.846 598.671h391.726"/><path stroke="url(#c)" stroke-width="2.418" d="M599.5 795.742V404.017"/><path stroke="url(#d)" stroke-width="2.418" d="m795.717 796.597-391.441-391.44"/><path fill="#fff" d="M600.709 656.704c-31.384 0-56.825-25.441-56.825-56.824 0-31.384 25.441-56.825 56.825-56.825 31.383 0 56.824 25.441 56.824 56.825 0 31.383-25.441 56.824-56.824 56.824Z"/><g clip-path="url(#e)"><path fill="#666" fill-rule="evenodd" d="M616.426 586.58h-31.434v16.176l3.553-3.554.531-.531h9.068l.074-.074 8.463-8.463h2.565l7.18 7.181V586.58Zm-15.715 14.654 3.698 3.699 1.283 1.282-2.565 2.565-1.282-1.283-5.2-5.199h-6.066l-5.514 5.514-.073.073v2.876a2.418 2.418 0 0 0 2.418 2.418h26.598a2.418 2.418 0 0 0 2.418-2.418v-8.317l-8.463-8.463-7.181 7.181-.071.072Zm-19.347 5.442v4.085a6.045 6.045 0 0 0 6.046 6.045h26.598a6.044 6.044 0 0 0 6.045-6.045v-7.108l1.356-1.355-1.282-1.283-.074-.073v-17.989h-38.689v23.43l-.146.146.146.147Z" clip-rule="evenodd"/></g><path stroke="#C9C9C9" stroke-width="2.418" d="M600.709 656.704c-31.384 0-56.825-25.441-56.825-56.824 0-31.384 25.441-56.825 56.825-56.825 31.383 0 56.824 25.441 56.824 56.825 0 31.383-25.441 56.824-56.824 56.824Z"/></g><defs><linearGradient id="a" x1="554.061" x2="-.48" y1=".083" y2=".087" gradientUnits="userSpaceOnUse"><stop stop-color="#C9C9C9" stop-opacity="0"/><stop offset=".208" stop-color="#C9C9C9"/><stop offset=".792" stop-color="#C9C9C9"/><stop offset="1" stop-color="#C9C9C9" stop-opacity="0"/></linearGradient><linearGradient id="b" x1="796.912" x2="404.507" y1="599.963" y2="599.965" gradientUnits="userSpaceOnUse"><stop stop-color="#C9C9C9" stop-opacity="0"/><stop offset=".208" stop-color="#C9C9C9"/><stop offset=".792" stop-color="#C9C9C9"/><stop offset="1" stop-color="#C9C9C9" stop-opacity="0"/></linearGradient><linearGradient id="c" x1="600.792" x2="600.794" y1="403.677" y2="796.082" gradientUnits="userSpaceOnUse"><stop stop-color="#C9C9C9" stop-opacity="0"/><stop offset=".208" stop-color="#C9C9C9"/><stop offset=".792" stop-color="#C9C9C9"/><stop offset="1" stop-color="#C9C9C9" stop-opacity="0"/></linearGradient><linearGradient id="d" x1="404.85" x2="796.972" y1="403.903" y2="796.02" gradientUnits="userSpaceOnUse"><stop stop-color="#C9C9C9" stop-opacity="0"/><stop offset=".208" stop-color="#C9C9C9"/><stop offset=".792" stop-color="#C9C9C9"/><stop offset="1" stop-color="#C9C9C9" stop-opacity="0"/></linearGradient><clipPath id="e"><path fill="#fff" d="M581.364 580.535h38.689v38.689h-38.689z"/></clipPath></defs></svg>
|
|
Binary file
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg width="1024" height="1024" viewBox="0 0 1024 1024" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_778_5)">
|
|
3
|
+
<rect width="1024" height="1024" fill="#83c409"/>
|
|
4
|
+
<path d="M706 795C706 807.667 701.667 818.667 693 828C684.333 836.667 673.667 841 661 841H521C490.333 841 464 830.333 442 809C420.667 787 410 760.333 410 729V211C410 197.667 414.333 186.667 423 178C431.667 169.333 442.333 165 455 165H483C495.667 165 506.333 169.333 515 178C524.333 186.667 529 197.667 529 211V311C529 319 533.333 323 542 323H661C673.667 323 684.333 327.667 693 337C701.667 345.667 706 356.667 706 370V397C706 408.333 701.667 419 693 429C683 437.667 672.333 442 661 442H542C533.333 442 529 446.667 529 456V710C529 718.667 533.333 723 542 723H661C673.667 723 684.333 727.333 693 736C701.667 744.667 706 755.667 706 769V795Z" fill="white"/>
|
|
5
|
+
<rect x="266" y="329" width="118" height="118" rx="59" fill="white"/>
|
|
6
|
+
</g>
|
|
7
|
+
<defs>
|
|
8
|
+
<clipPath id="clip0_778_5">
|
|
9
|
+
<rect width="1024" height="1024" fill="white"/>
|
|
10
|
+
</clipPath>
|
|
11
|
+
</defs>
|
|
12
|
+
</svg>
|
|
Binary file
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg width="1024" height="1024" viewBox="0 0 1024 1024" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_778_5)">
|
|
3
|
+
<rect width="1024" height="1024" fill="black"/>
|
|
4
|
+
<path d="M706 795C706 807.667 701.667 818.667 693 828C684.333 836.667 673.667 841 661 841H521C490.333 841 464 830.333 442 809C420.667 787 410 760.333 410 729V211C410 197.667 414.333 186.667 423 178C431.667 169.333 442.333 165 455 165H483C495.667 165 506.333 169.333 515 178C524.333 186.667 529 197.667 529 211V311C529 319 533.333 323 542 323H661C673.667 323 684.333 327.667 693 337C701.667 345.667 706 356.667 706 370V397C706 408.333 701.667 419 693 429C683 437.667 672.333 442 661 442H542C533.333 442 529 446.667 529 456V710C529 718.667 533.333 723 542 723H661C673.667 723 684.333 727.333 693 736C701.667 744.667 706 755.667 706 769V795Z" fill="white"/>
|
|
5
|
+
<rect x="266" y="329" width="118" height="118" rx="59" fill="white"/>
|
|
6
|
+
</g>
|
|
7
|
+
<defs>
|
|
8
|
+
<clipPath id="clip0_778_5">
|
|
9
|
+
<rect width="1024" height="1024" fill="white"/>
|
|
10
|
+
</clipPath>
|
|
11
|
+
</defs>
|
|
12
|
+
</svg>
|
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat routes for the REST API
|
|
3
|
+
*
|
|
4
|
+
* Handles chat message processing:
|
|
5
|
+
* - POST /api/chat - Send a message to the agent
|
|
6
|
+
*/
|
|
7
|
+
import { Hono } from 'hono';
|
|
8
|
+
import { ThreadManager } from '../managers/thread-manager.js';
|
|
9
|
+
import { NeovateExecutor } from '../managers/neovate-executor.js';
|
|
10
|
+
import { ConversationManager } from '../managers/conversation-manager.js';
|
|
11
|
+
import { ProcessingStateManager } from '../managers/processing-state-manager.js';
|
|
12
|
+
/**
|
|
13
|
+
* Creates chat routes
|
|
14
|
+
* @param threadManager - The ThreadManager instance
|
|
15
|
+
* @param neovateExecutor - The NeovateExecutor instance
|
|
16
|
+
* @param conversationManager - The ConversationManager instance
|
|
17
|
+
* @param processingStateManager - The ProcessingStateManager instance
|
|
18
|
+
* @returns Hono router with chat routes
|
|
19
|
+
*/
|
|
20
|
+
export declare function createChatRoutes(threadManager: ThreadManager, neovateExecutor: NeovateExecutor, conversationManager: ConversationManager, processingStateManager: ProcessingStateManager): Hono;
|
|
21
|
+
//# sourceMappingURL=chat-old.d.ts.map
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat routes for the REST API
|
|
3
|
+
*
|
|
4
|
+
* Handles chat message processing:
|
|
5
|
+
* - POST /api/chat - Send a message to the agent
|
|
6
|
+
*/
|
|
7
|
+
import { Hono } from 'hono';
|
|
8
|
+
import { delay } from '../utils.js';
|
|
9
|
+
import { streamAsyncGenerator } from '../lib/stream-helper.js';
|
|
10
|
+
/**
|
|
11
|
+
* Creates chat routes
|
|
12
|
+
* @param threadManager - The ThreadManager instance
|
|
13
|
+
* @param neovateExecutor - The NeovateExecutor instance
|
|
14
|
+
* @param conversationManager - The ConversationManager instance
|
|
15
|
+
* @param processingStateManager - The ProcessingStateManager instance
|
|
16
|
+
* @returns Hono router with chat routes
|
|
17
|
+
*/
|
|
18
|
+
export function createChatRoutes(threadManager, neovateExecutor, conversationManager, processingStateManager) {
|
|
19
|
+
const router = new Hono();
|
|
20
|
+
/**
|
|
21
|
+
* POST /api/chat
|
|
22
|
+
* Send a message to the agent
|
|
23
|
+
*
|
|
24
|
+
* Request body:
|
|
25
|
+
* {
|
|
26
|
+
* "threadId": "uuid",
|
|
27
|
+
* "message": "User message content",
|
|
28
|
+
* "model": "model-name",
|
|
29
|
+
* "attachments": [
|
|
30
|
+
* {
|
|
31
|
+
* "name": "file.txt",
|
|
32
|
+
* "content": "base64-encoded-content",
|
|
33
|
+
* "size": 1024,
|
|
34
|
+
* "mimeType": "text/plain"
|
|
35
|
+
* }
|
|
36
|
+
* ]
|
|
37
|
+
* }
|
|
38
|
+
*
|
|
39
|
+
* Response: Newline-delimited JSON stream of NeovateEvent objects
|
|
40
|
+
*
|
|
41
|
+
* Requirements:
|
|
42
|
+
* - 6.4 - THE CLI SHALL expose REST API endpoints for chat message processing
|
|
43
|
+
* - 8.5 - WHEN sending a chat message, THE App SHALL send a POST request with the message content and Selected_Thread context to the CLI
|
|
44
|
+
* - 5.4 - WHEN the Neovate command executes, THE CLI SHALL stream the output back to the App
|
|
45
|
+
*/
|
|
46
|
+
router.post('/', async (c) => {
|
|
47
|
+
try {
|
|
48
|
+
const body = await c.req.json();
|
|
49
|
+
const { threadId, content, model: baseModel, provider, attachments, planMode } = body;
|
|
50
|
+
// Prepend provider name (lowercased) to the model if provider is provided
|
|
51
|
+
let model = baseModel;
|
|
52
|
+
if (provider && typeof provider === 'string') {
|
|
53
|
+
const providerPrefix = provider.toLowerCase();
|
|
54
|
+
// Only prepend if the model doesn't already start with this provider prefix
|
|
55
|
+
if (!model.startsWith(providerPrefix + '/')) {
|
|
56
|
+
model = `${providerPrefix}/${model}`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Validate required fields
|
|
60
|
+
if (!threadId || typeof threadId !== 'string') {
|
|
61
|
+
const errorResponse = {
|
|
62
|
+
error: {
|
|
63
|
+
code: 'INVALID_REQUEST',
|
|
64
|
+
message: 'threadId is required and must be a string',
|
|
65
|
+
timestamp: new Date().toISOString()
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
return c.json(errorResponse, 400);
|
|
69
|
+
}
|
|
70
|
+
if (!content || typeof content !== 'string') {
|
|
71
|
+
const errorResponse = {
|
|
72
|
+
error: {
|
|
73
|
+
code: 'INVALID_REQUEST',
|
|
74
|
+
message: 'content is required and must be a string',
|
|
75
|
+
timestamp: new Date().toISOString()
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
return c.json(errorResponse, 400);
|
|
79
|
+
}
|
|
80
|
+
if (!model || typeof model !== 'string') {
|
|
81
|
+
const errorResponse = {
|
|
82
|
+
error: {
|
|
83
|
+
code: 'INVALID_REQUEST',
|
|
84
|
+
message: 'model is required and must be a string',
|
|
85
|
+
timestamp: new Date().toISOString()
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
return c.json(errorResponse, 400);
|
|
89
|
+
}
|
|
90
|
+
// Get thread metadata to build execution context
|
|
91
|
+
const thread = await threadManager.getThread(threadId);
|
|
92
|
+
if (!thread) {
|
|
93
|
+
const errorResponse = {
|
|
94
|
+
error: {
|
|
95
|
+
code: 'THREAD_NOT_FOUND',
|
|
96
|
+
message: `Thread not found: ${threadId}`,
|
|
97
|
+
timestamp: new Date().toISOString()
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
return c.json(errorResponse, 404);
|
|
101
|
+
}
|
|
102
|
+
// Capture thread path for use in generators
|
|
103
|
+
const threadPath = thread.path;
|
|
104
|
+
// Check if this is a replay request
|
|
105
|
+
if (content.trim().toLowerCase() === 'replay') {
|
|
106
|
+
console.log('[ChatRoute] Replay request detected');
|
|
107
|
+
// Get the last message from conversation history
|
|
108
|
+
const lastMessages = await conversationManager.getLastMessages(threadPath, 1);
|
|
109
|
+
if (lastMessages.length === 0) {
|
|
110
|
+
const errorResponse = {
|
|
111
|
+
error: {
|
|
112
|
+
code: 'NO_HISTORY',
|
|
113
|
+
message: 'No previous conversation found to replay',
|
|
114
|
+
timestamp: new Date().toISOString()
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
return c.json(errorResponse, 404);
|
|
118
|
+
}
|
|
119
|
+
const lastMessage = lastMessages[0];
|
|
120
|
+
// Check if message has a completed response
|
|
121
|
+
if (!lastMessage.response) {
|
|
122
|
+
const errorResponse = {
|
|
123
|
+
data: null,
|
|
124
|
+
error: {
|
|
125
|
+
code: 'NO_RESPONSE',
|
|
126
|
+
message: 'Previous message has no completed response to replay',
|
|
127
|
+
timestamp: new Date().toISOString()
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
return c.json(errorResponse, 404);
|
|
131
|
+
}
|
|
132
|
+
console.log('[ChatRoute] Replaying message:', {
|
|
133
|
+
messageId: lastMessage.id,
|
|
134
|
+
timestamp: lastMessage.timestamp,
|
|
135
|
+
eventCount: lastMessage.response.events.length,
|
|
136
|
+
});
|
|
137
|
+
// Extract response to ensure TypeScript narrowing
|
|
138
|
+
const response = lastMessage.response;
|
|
139
|
+
// Create a generator for replay events
|
|
140
|
+
async function* replayGenerator() {
|
|
141
|
+
// First, send a replay indicator event
|
|
142
|
+
const replayEvent = {
|
|
143
|
+
type: 'message',
|
|
144
|
+
role: 'system',
|
|
145
|
+
content: `🔄 Replaying previous conversation from ${lastMessage.timestamp}`
|
|
146
|
+
};
|
|
147
|
+
await delay(1000);
|
|
148
|
+
yield replayEvent;
|
|
149
|
+
// Then stream all the captured events
|
|
150
|
+
for (const event of response.events) {
|
|
151
|
+
console.log('[ChatRoute] Replaying event:', event);
|
|
152
|
+
await delay(1000);
|
|
153
|
+
yield event;
|
|
154
|
+
}
|
|
155
|
+
// Finally, send a completion indicator
|
|
156
|
+
const completeEvent = {
|
|
157
|
+
type: 'message',
|
|
158
|
+
role: 'system',
|
|
159
|
+
content: '✅ Replay complete'
|
|
160
|
+
};
|
|
161
|
+
await delay(1000);
|
|
162
|
+
yield completeEvent;
|
|
163
|
+
}
|
|
164
|
+
return streamAsyncGenerator(c, replayGenerator());
|
|
165
|
+
}
|
|
166
|
+
// Normal chat flow - capture and execute
|
|
167
|
+
// Build execution context
|
|
168
|
+
const context = {
|
|
169
|
+
threadId,
|
|
170
|
+
threadPath,
|
|
171
|
+
model,
|
|
172
|
+
provider,
|
|
173
|
+
attachments,
|
|
174
|
+
planMode,
|
|
175
|
+
};
|
|
176
|
+
console.log('[ChatRoute] Execution context:', {
|
|
177
|
+
threadId,
|
|
178
|
+
threadPath,
|
|
179
|
+
model,
|
|
180
|
+
planMode,
|
|
181
|
+
attachmentCount: attachments?.length || 0,
|
|
182
|
+
});
|
|
183
|
+
// Start capturing the conversation
|
|
184
|
+
const messageId = await conversationManager.startMessage(threadId, threadPath, content, model, attachments, planMode);
|
|
185
|
+
// Mark thread as processing
|
|
186
|
+
processingStateManager.setProcessing(threadId);
|
|
187
|
+
// Create a generator for chat execution events
|
|
188
|
+
async function* chatExecutionGenerator() {
|
|
189
|
+
const capturedEvents = [];
|
|
190
|
+
let fullContent = '';
|
|
191
|
+
try {
|
|
192
|
+
for await (const event of neovateExecutor.execute(content, context)) {
|
|
193
|
+
// Capture the event
|
|
194
|
+
capturedEvents.push(event);
|
|
195
|
+
// Accumulate content from message events
|
|
196
|
+
if (event.type === 'message' && event.content) {
|
|
197
|
+
fullContent += event.content;
|
|
198
|
+
}
|
|
199
|
+
// Yield the event for streaming
|
|
200
|
+
yield event;
|
|
201
|
+
}
|
|
202
|
+
// Complete the conversation message with captured data
|
|
203
|
+
await conversationManager.completeMessage(threadPath, messageId, fullContent, capturedEvents);
|
|
204
|
+
console.log('[ChatRoute] Conversation captured:', {
|
|
205
|
+
messageId,
|
|
206
|
+
eventCount: capturedEvents.length,
|
|
207
|
+
contentLength: fullContent.length,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
catch (error) {
|
|
211
|
+
const errorEvent = {
|
|
212
|
+
type: 'error',
|
|
213
|
+
error: {
|
|
214
|
+
code: 'STREAM_ERROR',
|
|
215
|
+
message: error instanceof Error ? error.message : String(error),
|
|
216
|
+
details: error instanceof Error ? { stack: error.stack } : undefined
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
// Capture the error event too
|
|
220
|
+
capturedEvents.push(errorEvent);
|
|
221
|
+
yield errorEvent;
|
|
222
|
+
// Try to save the partial conversation even on error
|
|
223
|
+
try {
|
|
224
|
+
await conversationManager.completeMessage(threadPath, messageId, fullContent, capturedEvents);
|
|
225
|
+
}
|
|
226
|
+
catch (saveError) {
|
|
227
|
+
console.error('[ChatRoute] Failed to save partial conversation:', saveError);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
finally {
|
|
231
|
+
// Clear processing state when done
|
|
232
|
+
processingStateManager.clearProcessing(threadId);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return streamAsyncGenerator(c, chatExecutionGenerator());
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
const errorResponse = {
|
|
239
|
+
error: {
|
|
240
|
+
code: 'REQUEST_PARSE_ERROR',
|
|
241
|
+
message: 'Failed to parse request body',
|
|
242
|
+
details: error instanceof Error ? error.message : String(error),
|
|
243
|
+
timestamp: new Date().toISOString()
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
return c.json(errorResponse, 400);
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
return router;
|
|
250
|
+
}
|
|
251
|
+
//# sourceMappingURL=chat-old.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat routes for the REST API
|
|
3
|
+
*
|
|
4
|
+
* Handles chat message processing:
|
|
5
|
+
* - POST /api/chat - Send a message to the agent
|
|
6
|
+
*/
|
|
7
|
+
import { Hono } from 'hono';
|
|
8
|
+
import { ThreadManager } from '../managers/thread-manager.js';
|
|
9
|
+
import { NeovateExecutor } from '../managers/neovate-executor.js';
|
|
10
|
+
import { ConversationManager } from '../managers/conversation-manager.js';
|
|
11
|
+
import { ProcessingStateManager } from '../managers/processing-state-manager.js';
|
|
12
|
+
/**
|
|
13
|
+
* Creates chat routes
|
|
14
|
+
* @param threadManager - The ThreadManager instance
|
|
15
|
+
* @param neovateExecutor - The NeovateExecutor instance
|
|
16
|
+
* @param conversationManager - The ConversationManager instance
|
|
17
|
+
* @param processingStateManager - The ProcessingStateManager instance
|
|
18
|
+
* @returns Hono router with chat routes
|
|
19
|
+
*/
|
|
20
|
+
export declare function createChatRoutes(threadManager: ThreadManager, neovateExecutor: NeovateExecutor, conversationManager: ConversationManager, processingStateManager: ProcessingStateManager): Hono;
|
|
21
|
+
//# sourceMappingURL=chat.d.ts.map
|