@myrialabs/clopen 0.2.24 → 0.3.1
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 -1
- package/backend/chat/helpers.ts +2 -20
- package/backend/chat/stream-manager.ts +556 -547
- package/backend/database/migrations/029_migrate_messages_to_unified.ts +1108 -0
- package/backend/database/migrations/index.ts +7 -0
- package/backend/database/queries/engine-queries.ts +195 -36
- package/backend/database/queries/index.ts +1 -2
- package/backend/database/queries/message-queries.ts +84 -139
- package/backend/database/queries/session-queries.ts +167 -21
- package/backend/database/queries/snapshot-queries.ts +5 -4
- package/backend/database/queries/utils-queries.ts +2 -2
- package/backend/engine/adapters/claude/environment.ts +4 -5
- package/backend/engine/adapters/claude/message-converter.ts +552 -0
- package/backend/engine/adapters/claude/stream.ts +59 -47
- package/backend/engine/adapters/opencode/config.ts +7 -7
- package/backend/engine/adapters/opencode/message-converter.ts +328 -352
- package/backend/engine/adapters/opencode/stream.ts +84 -101
- package/backend/engine/types.ts +17 -11
- package/backend/project/status-manager.ts +10 -13
- package/backend/snapshot/helpers.ts +46 -90
- package/backend/snapshot/snapshot-service.ts +1 -1
- package/backend/utils/paths.ts +22 -1
- package/backend/ws/chat/index.ts +1 -11
- package/backend/ws/chat/stream.ts +101 -61
- package/backend/ws/engine/claude/accounts.ts +27 -7
- package/backend/ws/engine/claude/status.ts +3 -2
- package/backend/ws/engine/opencode/providers.ts +25 -24
- package/backend/ws/git/commit-message.ts +6 -8
- package/backend/ws/messages/crud.ts +4 -59
- package/backend/ws/sessions/crud.ts +78 -130
- package/backend/ws/sessions/index.ts +1 -9
- package/backend/ws/settings/crud.ts +14 -11
- package/backend/ws/snapshot/restore.ts +23 -26
- package/backend/ws/snapshot/timeline.ts +5 -5
- package/dist/assets/{index-w7Uwi2Jz.js → index-BVWBZlgD.js} +2 -2
- package/dist/assets/main-Cgbs6dR7.js +246 -0
- package/dist/assets/main-TEa2MRnh.css +1 -0
- package/dist/index.html +2 -2
- package/package.json +4 -4
- package/shared/constants/engines.ts +141 -56
- package/shared/types/database/schema.ts +39 -40
- package/shared/types/stores/settings.ts +8 -4
- package/shared/types/unified/common.ts +21 -0
- package/shared/types/unified/display.ts +25 -0
- package/shared/types/unified/engine.ts +61 -0
- package/shared/types/unified/index.ts +130 -0
- package/shared/types/unified/message.ts +151 -0
- package/shared/types/unified/stream.ts +157 -0
- package/shared/types/unified/tool.ts +409 -0
- package/shared/utils/message-formatter.ts +9 -73
- package/shared/utils/path.ts +3 -2
- package/tsconfig.json +1 -1
- package/backend/database/queries/opencode-provider-queries.ts +0 -190
- package/backend/engine/adapters/claude/path-utils.ts +0 -38
- package/backend/ws/chat/background.ts +0 -201
- package/dist/assets/main-B4q8wX9B.js +0 -257
- package/dist/assets/main-Bfz5Urp3.css +0 -1
- package/shared/types/engine/index.ts +0 -45
- package/shared/types/messaging/index.ts +0 -242
- package/shared/types/messaging/tool.ts +0 -374
package/README.md
CHANGED
|
@@ -150,7 +150,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines and [DECISIONS.md](DECISIO
|
|
|
150
150
|
| Terminal | bun-pty |
|
|
151
151
|
| AI Engines | Claude Code + OpenCode |
|
|
152
152
|
|
|
153
|
-
Clopen uses an engine-agnostic adapter pattern — both engines normalize output to
|
|
153
|
+
Clopen uses an engine-agnostic adapter pattern — both engines normalize output to a unified message format (`shared/types/unified`), ensuring a consistent experience regardless of which engine is selected.
|
|
154
154
|
|
|
155
155
|
---
|
|
156
156
|
|
package/backend/chat/helpers.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { debug } from '$shared/utils/logger';
|
|
3
|
-
import type { SDKMessage, ClaudeStreamRequest } from '$shared/types/messaging';
|
|
1
|
+
import type { StreamRequest } from '$shared/types/unified/stream';
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
4
|
* Bun-compatible existsSync implementation
|
|
@@ -18,25 +16,9 @@ export async function existsSync(filePath: string): Promise<boolean> {
|
|
|
18
16
|
/**
|
|
19
17
|
* In-memory storage for stream sessions (in production, use Redis or database)
|
|
20
18
|
*/
|
|
21
|
-
export const sessionStore = new Map<string,
|
|
19
|
+
export const sessionStore = new Map<string, StreamRequest>();
|
|
22
20
|
|
|
23
21
|
/**
|
|
24
22
|
* Track active connections to prevent duplicates
|
|
25
23
|
*/
|
|
26
24
|
export const activeConnections = new Map<string, string>(); // streamId -> connectionId
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Save message to database using database function with current timestamp
|
|
30
|
-
*/
|
|
31
|
-
export async function saveMessageToDatabase(message: SDKMessage, sessionId: string, timestamp?: string): Promise<void> {
|
|
32
|
-
try {
|
|
33
|
-
messageQueries.create({
|
|
34
|
-
session_id: sessionId,
|
|
35
|
-
sdk_message: message,
|
|
36
|
-
timestamp: timestamp || new Date().toISOString()
|
|
37
|
-
});
|
|
38
|
-
} catch (error) {
|
|
39
|
-
debug.error('chat', 'Failed to save message to database:', error);
|
|
40
|
-
// Don't throw - we don't want message saving to break the stream
|
|
41
|
-
}
|
|
42
|
-
}
|