@myrialabs/clopen 0.4.14 → 0.4.16
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/backend/artifacts/matrix.ts +8 -0
- package/backend/artifacts/types.ts +2 -2
- package/backend/auth/permissions.ts +16 -0
- package/backend/chat/stream-manager.ts +5 -5
- package/backend/commands/detect.ts +1 -1
- package/backend/commands/sync.ts +1 -1
- package/backend/database/migrations/056_support_mssql_driver.ts +137 -0
- package/backend/database/migrations/057_seed_pi_provider.ts +25 -0
- package/backend/database/migrations/058_seed_cline_provider.ts +25 -0
- package/backend/database/migrations/059_seed_cursor_provider.ts +25 -0
- package/backend/database/migrations/index.ts +28 -0
- package/backend/database/queries/engine-queries.ts +13 -0
- package/backend/database/queries/message-queries.ts +43 -1
- package/backend/db-client/connection-manager.ts +8 -2
- package/backend/db-client/drivers/mssql.ts +829 -0
- package/backend/db-client/drivers/mysql.ts +33 -4
- package/backend/db-client/drivers/postgres.ts +55 -5
- package/backend/db-client/drivers/sql-builders.test.ts +70 -0
- package/backend/db-client/drivers/sql-builders.ts +9 -2
- package/backend/db-client/pool-config.ts +32 -0
- package/backend/db-client/query-executor.test.ts +42 -0
- package/backend/db-client/query-executor.ts +47 -3
- package/backend/engine/README.md +36 -13
- package/backend/engine/adapters/cline/agent-tool.ts +64 -0
- package/backend/engine/adapters/cline/ask-question-tool.ts +105 -0
- package/backend/engine/adapters/cline/credential.ts +166 -0
- package/backend/engine/adapters/cline/error-handler.ts +49 -0
- package/backend/engine/adapters/cline/index.ts +1 -0
- package/backend/engine/adapters/cline/mcp-tools.ts +119 -0
- package/backend/engine/adapters/cline/message-converter.ts +396 -0
- package/backend/engine/adapters/cline/models.ts +73 -0
- package/backend/engine/adapters/cline/presets.ts +128 -0
- package/backend/engine/adapters/cline/stream.ts +413 -0
- package/backend/engine/adapters/codex/credential.ts +1 -1
- package/backend/engine/adapters/codex/message-converter.ts +4 -4
- package/backend/engine/adapters/codex/session-fork.ts +1 -1
- package/backend/engine/adapters/codex/stream.ts +3 -3
- package/backend/engine/adapters/copilot/stream.ts +1 -1
- package/backend/engine/adapters/cursor/ask-question-tool.ts +98 -0
- package/backend/engine/adapters/cursor/credential.ts +68 -0
- package/backend/engine/adapters/cursor/environment.ts +32 -0
- package/backend/engine/adapters/cursor/error-handler.ts +60 -0
- package/backend/engine/adapters/cursor/index.ts +1 -0
- package/backend/engine/adapters/cursor/message-converter.ts +615 -0
- package/backend/engine/adapters/cursor/models.ts +68 -0
- package/backend/engine/adapters/cursor/session-fork.ts +68 -0
- package/backend/engine/adapters/cursor/stream.ts +341 -0
- package/backend/engine/adapters/opencode/config.ts +9 -0
- package/backend/engine/adapters/opencode/models.ts +10 -1
- package/backend/engine/adapters/opencode/server.ts +110 -2
- package/backend/engine/adapters/pi/agent-tool.ts +62 -0
- package/backend/engine/adapters/pi/ask-question-tool.ts +93 -0
- package/backend/engine/adapters/pi/credential.ts +137 -0
- package/backend/engine/adapters/pi/environment.ts +33 -0
- package/backend/engine/adapters/pi/error-handler.ts +46 -0
- package/backend/engine/adapters/pi/index.ts +1 -0
- package/backend/engine/adapters/pi/mcp-tools.ts +131 -0
- package/backend/engine/adapters/pi/message-converter.ts +446 -0
- package/backend/engine/adapters/pi/models.ts +53 -0
- package/backend/engine/adapters/pi/presets.ts +133 -0
- package/backend/engine/adapters/pi/session-fork.ts +46 -0
- package/backend/engine/adapters/pi/stream.ts +427 -0
- package/backend/engine/adapters/qwen/message-converter.ts +5 -5
- package/backend/engine/adapters/qwen/stream.ts +2 -2
- package/backend/engine/docs/adapter-contract.md +7 -2
- package/backend/engine/docs/adding-an-engine.md +70 -12
- package/backend/engine/docs/artifacts.md +124 -0
- package/backend/engine/docs/database.md +4 -4
- package/backend/engine/docs/frontend-and-chat.md +22 -4
- package/backend/engine/docs/lessons-learned.md +219 -32
- package/backend/engine/docs/quick-reference.md +18 -7
- package/backend/engine/docs/websocket-routes.md +2 -2
- package/backend/engine/index.ts +9 -0
- package/backend/index.ts +6 -0
- package/backend/mcp/README.md +3 -3
- package/backend/mcp/external/config.ts +11 -0
- package/backend/mcp/index.ts +8 -0
- package/backend/mcp/internal/config.ts +33 -1
- package/backend/permissions/service.ts +5 -2
- package/backend/preview/browser/browser-preview-service.ts +15 -6
- package/backend/preview/browser/browser-video-capture.ts +232 -100
- package/backend/preview/browser/scripts/video-stream.ts +216 -56
- package/backend/preview/browser/types.ts +24 -12
- package/backend/skills/sync.ts +1 -1
- package/backend/subagents/detect.ts +1 -1
- package/backend/subagents/sync.ts +1 -1
- package/backend/ws/chat/stream.ts +13 -5
- package/backend/ws/db-client/connections.ts +2 -1
- package/backend/ws/db-client/query.ts +41 -4
- package/backend/ws/db-client/schema.ts +45 -1
- package/backend/ws/engine/claude/accounts.ts +37 -13
- package/backend/ws/engine/cline/accounts.ts +317 -0
- package/backend/ws/engine/cline/index.ts +15 -0
- package/backend/ws/engine/cline/presets.ts +36 -0
- package/backend/ws/engine/cline/status.ts +49 -0
- package/backend/ws/engine/codex/accounts.ts +37 -5
- package/backend/ws/engine/copilot/accounts.ts +12 -0
- package/backend/ws/engine/cursor/accounts.ts +162 -0
- package/backend/ws/engine/cursor/index.ts +13 -0
- package/backend/ws/engine/cursor/status.ts +55 -0
- package/backend/ws/engine/index.ts +6 -0
- package/backend/ws/engine/opencode/providers.ts +72 -1
- package/backend/ws/engine/pi/accounts.ts +319 -0
- package/backend/ws/engine/pi/index.ts +15 -0
- package/backend/ws/engine/pi/presets.ts +34 -0
- package/backend/ws/engine/pi/status.ts +50 -0
- package/backend/ws/engine/qwen/accounts.ts +22 -0
- package/backend/ws/messages/crud.ts +13 -0
- package/backend/ws/preview/browser/interact.ts +10 -8
- package/backend/ws/preview/browser/webcodecs.ts +26 -2
- package/backend/ws/sessions/crud.ts +2 -2
- package/backend/ws/settings/crud.ts +2 -2
- package/dist/assets/{index-CDZf6lfv.js → index-BPvctwJ2.js} +1 -1
- package/dist/assets/{index-BWf-DDJN.js → index-vLKZpWQH.js} +1 -1
- package/dist/assets/{main-C15mQTCW.js → main-BtBZvCwv.js} +428 -386
- package/dist/assets/main-D7ATW8pp.css +1 -0
- package/dist/index.html +2 -2
- package/package.json +11 -1
- package/shared/constants/engine-tools.ts +16 -2
- package/shared/constants/engines.ts +27 -0
- package/shared/types/db-client/connection.ts +1 -1
- package/shared/types/db-client/query.ts +4 -1
- package/shared/types/unified/common.ts +1 -1
- package/shared/types/unified/engine.ts +82 -1
- package/shared/types/unified/index.ts +6 -0
- package/shared/types/unified/message.ts +1 -1
- package/shared/utils/db-client/split-sql.test.ts +13 -0
- package/shared/utils/db-client/split-sql.ts +38 -1
- package/shared/utils/subagent-wire-trim.ts +87 -0
- package/dist/assets/main-Ba5ZGlY4.css +0 -1
package/backend/mcp/index.ts
CHANGED
|
@@ -136,6 +136,14 @@ export function getCopilotMcpConfig(profileFilter?: Set<string>) {
|
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
/** Cursor MCP config: internal `clopen-mcp` remote bridge + external servers. */
|
|
140
|
+
export function getCursorMcpConfig(profileFilter?: Set<string>) {
|
|
141
|
+
return {
|
|
142
|
+
...internal.getCursorMcpConfig(profileFilter),
|
|
143
|
+
...external.getCursorExternalMcpConfig(profileFilter)
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
139
147
|
/** Qwen Code MCP config. */
|
|
140
148
|
export function getQwenMcpConfig(profileFilter?: Set<string>) {
|
|
141
149
|
return {
|
|
@@ -9,6 +9,7 @@ import { createSdkMcpServer, tool, type McpSdkServerConfigWithInstance, type Mcp
|
|
|
9
9
|
import type { McpRemoteConfig } from '@opencode-ai/sdk';
|
|
10
10
|
import type { MCPHTTPServerConfig } from '@github/copilot-sdk';
|
|
11
11
|
import type { CLIMcpServerConfig as QwenMcpServerConfig } from '@qwen-code/sdk';
|
|
12
|
+
import type { McpServerConfig as CursorMcpServerConfig } from '@cursor/sdk';
|
|
12
13
|
import type { ServerConfig, ParsedMcpToolName, ServerName } from './types';
|
|
13
14
|
import type { McpExecutionContext } from '../../engine/types';
|
|
14
15
|
import { serverRegistry, serverFactories, serverMetadata } from './servers';
|
|
@@ -605,6 +606,37 @@ export function getCopilotMcpConfig(profileFilter?: Set<string>): Record<string,
|
|
|
605
606
|
};
|
|
606
607
|
}
|
|
607
608
|
|
|
609
|
+
// ============================================================================
|
|
610
|
+
// Cursor MCP Configuration
|
|
611
|
+
// ============================================================================
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Get MCP configuration for the Cursor engine.
|
|
615
|
+
*
|
|
616
|
+
* The Cursor SDK (`@cursor/sdk`) accepts a `mcpServers` map whose HTTP variant is
|
|
617
|
+
* `{ type: 'http', url, headers? }`. We reuse the SAME in-process `/mcp` bridge
|
|
618
|
+
* Open Code, Codex, Copilot and Qwen already consume — no new HTTP server, no
|
|
619
|
+
* per-engine bridge (README §10.12). The service-token bearer authorises the hop.
|
|
620
|
+
*/
|
|
621
|
+
export function getCursorMcpConfig(profileFilter?: Set<string>): Record<string, CursorMcpServerConfig> {
|
|
622
|
+
const enabledServers = activeInternalServerNames(profileFilter);
|
|
623
|
+
if (enabledServers.length === 0) {
|
|
624
|
+
return {};
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
const port = SERVER_ENV.PORT;
|
|
628
|
+
|
|
629
|
+
debug.log('mcp', `📦 Cursor MCP: remote server at http://localhost:${port}/mcp`);
|
|
630
|
+
|
|
631
|
+
return {
|
|
632
|
+
'clopen-mcp': {
|
|
633
|
+
type: 'http',
|
|
634
|
+
url: `http://localhost:${port}/mcp`,
|
|
635
|
+
headers: { Authorization: `Bearer ${getMcpServiceToken()}` },
|
|
636
|
+
},
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
|
|
608
640
|
// ============================================================================
|
|
609
641
|
// Qwen Code MCP Configuration
|
|
610
642
|
// ============================================================================
|
|
@@ -616,7 +648,7 @@ export function getCopilotMcpConfig(profileFilter?: Set<string>): Record<string,
|
|
|
616
648
|
* a `CLIMcpServerConfig` value that supports the Streamable-HTTP transport via
|
|
617
649
|
* `httpUrl`. We reuse the SAME `/mcp` URL Open Code, Codex and Copilot already
|
|
618
650
|
* consume — no new HTTP server, no per-engine bridge. Tool handlers run
|
|
619
|
-
* in-process in the Clopen backend (README §
|
|
651
|
+
* in-process in the Clopen backend (README §10.12).
|
|
620
652
|
*
|
|
621
653
|
* Approval: the Qwen adapter uses `permissionMode: 'default'` with a
|
|
622
654
|
* `canUseTool` callback that auto-allows everything. `AskUserQuestion` is
|
|
@@ -20,14 +20,17 @@ import { debug } from '$shared/utils/logger';
|
|
|
20
20
|
import { mergeLayers, pickEngineSet, isToolAllowed, hasAnyRestriction, type ResolvedPermissions } from './resolve';
|
|
21
21
|
|
|
22
22
|
/** Engine keys used by the artifact matrix (config-dir slugs). */
|
|
23
|
-
export type ArtifactEngineKey = 'claude' | 'codex' | 'copilot' | 'qwen' | 'opencode';
|
|
23
|
+
export type ArtifactEngineKey = 'claude' | 'codex' | 'copilot' | 'qwen' | 'opencode' | 'pi' | 'cline' | 'cursor';
|
|
24
24
|
|
|
25
25
|
const ENGINE_TYPE_TO_ARTIFACT: Record<EngineType, ArtifactEngineKey> = {
|
|
26
26
|
'claude-code': 'claude',
|
|
27
27
|
codex: 'codex',
|
|
28
28
|
copilot: 'copilot',
|
|
29
29
|
qwen: 'qwen',
|
|
30
|
-
opencode: 'opencode'
|
|
30
|
+
opencode: 'opencode',
|
|
31
|
+
pi: 'pi',
|
|
32
|
+
cline: 'cline',
|
|
33
|
+
cursor: 'cursor'
|
|
31
34
|
};
|
|
32
35
|
|
|
33
36
|
export function toArtifactEngine(engine: EngineType): ArtifactEngineKey {
|
|
@@ -366,7 +366,7 @@ export class BrowserPreviewService extends EventEmitter {
|
|
|
366
366
|
// ============================================================================
|
|
367
367
|
// WebCodecs Streaming Methods (optimized, ~20-40ms, lower bandwidth)
|
|
368
368
|
// ============================================================================
|
|
369
|
-
async startWebCodecsStreaming(tabId: string): Promise<boolean> {
|
|
369
|
+
async startWebCodecsStreaming(tabId: string, allowVp9 = true): Promise<boolean> {
|
|
370
370
|
const tab = this.getTab(tabId);
|
|
371
371
|
if (!tab) {
|
|
372
372
|
return false;
|
|
@@ -374,7 +374,8 @@ export class BrowserPreviewService extends EventEmitter {
|
|
|
374
374
|
return await this.videoCapture.startStreaming(
|
|
375
375
|
tabId,
|
|
376
376
|
tab,
|
|
377
|
-
() => this.isValidTab(tabId)
|
|
377
|
+
() => this.isValidTab(tabId),
|
|
378
|
+
allowVp9
|
|
378
379
|
);
|
|
379
380
|
}
|
|
380
381
|
|
|
@@ -383,20 +384,28 @@ export class BrowserPreviewService extends EventEmitter {
|
|
|
383
384
|
await this.videoCapture.stopStreaming(tabId, tab ?? undefined);
|
|
384
385
|
}
|
|
385
386
|
|
|
386
|
-
async
|
|
387
|
+
async refreshWebCodecsScreencast(tabId: string): Promise<boolean> {
|
|
387
388
|
const tab = this.getTab(tabId);
|
|
388
389
|
if (!tab) {
|
|
389
390
|
return false;
|
|
390
391
|
}
|
|
391
|
-
return await this.videoCapture.
|
|
392
|
+
return await this.videoCapture.refreshScreencast(tabId, tab);
|
|
392
393
|
}
|
|
393
394
|
|
|
394
|
-
async
|
|
395
|
+
async requestWebCodecsKeyframe(tabId: string): Promise<boolean> {
|
|
395
396
|
const tab = this.getTab(tabId);
|
|
396
397
|
if (!tab) {
|
|
397
398
|
return false;
|
|
398
399
|
}
|
|
399
|
-
return await this.videoCapture.
|
|
400
|
+
return await this.videoCapture.requestKeyframe(tabId, tab);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
async updateWebCodecsViewport(tabId: string, width: number, height: number): Promise<boolean> {
|
|
404
|
+
const tab = this.getTab(tabId);
|
|
405
|
+
if (!tab) {
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
return await this.videoCapture.updateViewport(tabId, tab, width, height);
|
|
400
409
|
}
|
|
401
410
|
|
|
402
411
|
async getWebCodecsOffer(tabId: string): Promise<RTCSessionDescriptionInit | null> {
|