cursorconnect 0.1.5 → 0.1.7
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/bridge-runtime/.env.example +10 -2
- package/bridge-runtime/connector-version.json +1 -0
- package/bridge-runtime/dist/agent-completion-push.d.ts +42 -0
- package/bridge-runtime/dist/agent-completion-push.js +220 -0
- package/bridge-runtime/dist/agent-title-match.d.ts +8 -7
- package/bridge-runtime/dist/agent-title-match.js +11 -1
- package/bridge-runtime/dist/chat-display-store.d.ts +21 -9
- package/bridge-runtime/dist/chat-display-store.js +94 -23
- package/bridge-runtime/dist/chat-display.d.ts +2 -0
- package/bridge-runtime/dist/chat-display.js +197 -33
- package/bridge-runtime/dist/chat-history-mode.d.ts +5 -0
- package/bridge-runtime/dist/chat-history-mode.js +7 -0
- package/bridge-runtime/dist/command-executor.d.ts +2 -0
- package/bridge-runtime/dist/command-executor.js +44 -0
- package/bridge-runtime/dist/composer-title-index.d.ts +1 -0
- package/bridge-runtime/dist/composer-title-index.js +7 -7
- package/bridge-runtime/dist/connector-client-version.d.ts +2 -0
- package/bridge-runtime/dist/connector-client-version.js +43 -0
- package/bridge-runtime/dist/debug-chats-page.d.ts +2 -0
- package/bridge-runtime/dist/debug-chats-page.js +491 -0
- package/bridge-runtime/dist/dom-transcript-store.d.ts +17 -0
- package/bridge-runtime/dist/dom-transcript-store.js +76 -0
- package/bridge-runtime/dist/extract-page.js +56 -85
- package/bridge-runtime/dist/history-limit.d.ts +2 -0
- package/bridge-runtime/dist/history-limit.js +2 -0
- package/bridge-runtime/dist/history-request.d.ts +8 -0
- package/bridge-runtime/dist/history-request.js +7 -0
- package/bridge-runtime/dist/index.js +4 -0
- package/bridge-runtime/dist/jsonl-index.d.ts +21 -3
- package/bridge-runtime/dist/jsonl-index.js +237 -73
- package/bridge-runtime/dist/jsonl-live-debug.d.ts +24 -0
- package/bridge-runtime/dist/jsonl-live-debug.js +175 -0
- package/bridge-runtime/dist/media-path.d.ts +2 -0
- package/bridge-runtime/dist/media-path.js +17 -0
- package/bridge-runtime/dist/message-filter.d.ts +2 -0
- package/bridge-runtime/dist/message-filter.js +21 -5
- package/bridge-runtime/dist/pairing-code.d.ts +2 -0
- package/bridge-runtime/dist/pairing-code.js +9 -2
- package/bridge-runtime/dist/relay-upstream.d.ts +2 -1
- package/bridge-runtime/dist/relay-upstream.js +13 -2
- package/bridge-runtime/dist/relay.d.ts +21 -0
- package/bridge-runtime/dist/relay.js +332 -28
- package/bridge-runtime/dist/types.d.ts +21 -0
- package/bridge-runtime/selectors.json +4 -5
- package/dist/bundled-bridge-check.js +25 -0
- package/dist/index.js +87 -10
- package/dist/launch.js +47 -0
- package/dist/macos-autostart.js +87 -0
- package/dist/pairing-code.js +12 -3
- package/dist/print-pairing.js +2 -0
- package/dist/run-service.js +31 -0
- package/dist/startup-check.js +165 -0
- package/package.json +1 -1
- package/version-policy.json +1 -1
|
@@ -7,7 +7,7 @@ const EDITED_DIFF = /^Edited\s+.+\s*\+\d+/i;
|
|
|
7
7
|
const FILE_DIFF = /\.[a-z0-9]+\s*[+-]\d+/i;
|
|
8
8
|
const TOOL_COMMAND = /^(cd |npm |npx |curl |git |node )/i;
|
|
9
9
|
/** Cursor pauses chat while background agent / shell runs */
|
|
10
|
-
export const BACKGROUND_WORK_STATUS = /will resume when|background work finishes|background shell|resuming when|paused while|waiting for background/i;
|
|
10
|
+
export const BACKGROUND_WORK_STATUS = /will resume when|background work finishes|background shell|resuming when|paused while|waiting for background|waiting for \d+ command/i;
|
|
11
11
|
export const AGENT_STATUS_BACKGROUND_SHELL = 'background_shell';
|
|
12
12
|
export const WORKING_STATUS_LINE = /^working\.?$/i;
|
|
13
13
|
/** Short DOM status line only — not a sentence inside a chat message. */
|
|
@@ -72,11 +72,31 @@ export function isNoiseChatText(text) {
|
|
|
72
72
|
return true;
|
|
73
73
|
return false;
|
|
74
74
|
}
|
|
75
|
+
/** Markdown / structured answer — must stay in chat lenta even if it mentions bridge symbols. */
|
|
76
|
+
export function isUserFacingAssistantProse(text) {
|
|
77
|
+
const t = stripJsonlRedactionArtifacts(text).trim();
|
|
78
|
+
if (!t)
|
|
79
|
+
return false;
|
|
80
|
+
if (/^##\s+\S/m.test(t))
|
|
81
|
+
return true;
|
|
82
|
+
if (/^\*\*[^*]{2,}\*\*/m.test(t) && t.length >= 60)
|
|
83
|
+
return true;
|
|
84
|
+
const tableRows = t.match(/^\|[^\n]+\|$/gm);
|
|
85
|
+
if (tableRows && tableRows.length >= 2)
|
|
86
|
+
return true;
|
|
87
|
+
if (/^[-*]\s+\S/m.test(t) && t.length >= 100)
|
|
88
|
+
return true;
|
|
89
|
+
if (/^(?:\d+\.\s+\S|>\s)/m.test(t) && t.length >= 150)
|
|
90
|
+
return true;
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
75
93
|
/** Chain-of-thought / tool trace rows — not user-facing answers (DOM + JSONL). */
|
|
76
94
|
export function isAssistantReflectionText(text) {
|
|
77
95
|
const t = stripJsonlRedactionArtifacts(text).trim().replace(/\s+/g, ' ');
|
|
78
96
|
if (!t || isNoiseChatText(t))
|
|
79
97
|
return true;
|
|
98
|
+
if (isUserFacingAssistantProse(t))
|
|
99
|
+
return false;
|
|
80
100
|
if (/^Thought\s*for\s*\d/i.test(t) && t.length < 160)
|
|
81
101
|
return true;
|
|
82
102
|
if (/^(Exploring|Grepped|Searched|Listed|Read |Ran |Edited |Loading|Planning|Using image)/i.test(t)) {
|
|
@@ -85,10 +105,6 @@ export function isAssistantReflectionText(text) {
|
|
|
85
105
|
const toolHits = t.match(/\b(Explored|Grepped|Searched|Listed|Read )\b/gi);
|
|
86
106
|
if (toolHits && toolHits.length >= 2)
|
|
87
107
|
return true;
|
|
88
|
-
if (t.length > 160 &&
|
|
89
|
-
/\b(state\.messages|flat-index|mapKeyedChildren|humanEl|extract-page|userMessagesEquivalent)\b/i.test(t)) {
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
108
|
return false;
|
|
93
109
|
}
|
|
94
110
|
/** Short agent status worth showing (not tool log). */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export declare const PAIRING_CODE_LENGTH = 6;
|
|
2
|
+
/** @see connect/src/pairing-code.ts — keep in sync */
|
|
3
|
+
export declare const PAIRING_CODE_ALPHABET = "ACDEFHJKMNPRTUVWXY3479";
|
|
2
4
|
export declare function generatePairingCode(): string;
|
|
3
5
|
export declare function normalizePairingCode(raw: string): string | null;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { randomBytes } from 'crypto';
|
|
2
2
|
export const PAIRING_CODE_LENGTH = 6;
|
|
3
|
-
|
|
3
|
+
/** @see connect/src/pairing-code.ts — keep in sync */
|
|
4
|
+
export const PAIRING_CODE_ALPHABET = 'ACDEFHJKMNPRTUVWXY3479';
|
|
5
|
+
const ALPHABET_SET = new Set(PAIRING_CODE_ALPHABET.split(''));
|
|
4
6
|
export function generatePairingCode() {
|
|
5
7
|
const bytes = randomBytes(PAIRING_CODE_LENGTH);
|
|
8
|
+
const n = PAIRING_CODE_ALPHABET.length;
|
|
6
9
|
let out = '';
|
|
7
10
|
for (let i = 0; i < PAIRING_CODE_LENGTH; i++) {
|
|
8
|
-
out +=
|
|
11
|
+
out += PAIRING_CODE_ALPHABET[bytes[i] % n];
|
|
9
12
|
}
|
|
10
13
|
return out;
|
|
11
14
|
}
|
|
@@ -13,5 +16,9 @@ export function normalizePairingCode(raw) {
|
|
|
13
16
|
const code = raw.replace(/[^a-zA-Z0-9]/g, '').toUpperCase();
|
|
14
17
|
if (code.length !== PAIRING_CODE_LENGTH)
|
|
15
18
|
return null;
|
|
19
|
+
for (const ch of code) {
|
|
20
|
+
if (!ALPHABET_SET.has(ch))
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
16
23
|
return code;
|
|
17
24
|
}
|
|
@@ -3,8 +3,9 @@ export type UpstreamCommandHandler = (event: string, ...args: unknown[]) => void
|
|
|
3
3
|
export declare class RelayUpstream {
|
|
4
4
|
private config;
|
|
5
5
|
private onClientEvent;
|
|
6
|
+
private onConnect?;
|
|
6
7
|
private socket;
|
|
7
|
-
constructor(config: ServerConfig, onClientEvent: UpstreamCommandHandler);
|
|
8
|
+
constructor(config: ServerConfig, onClientEvent: UpstreamCommandHandler, onConnect?: (() => void) | undefined);
|
|
8
9
|
private registerPairing;
|
|
9
10
|
connect(): void;
|
|
10
11
|
emit(event: string, ...args: unknown[]): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { io } from 'socket.io-client';
|
|
2
|
+
import { connectorClientVersion } from './connector-client-version.js';
|
|
2
3
|
import { loadPairingIdentity } from './pairing-identity.js';
|
|
3
4
|
const CLIENT_EVENTS = [
|
|
4
5
|
'command',
|
|
@@ -11,10 +12,12 @@ const CLIENT_EVENTS = [
|
|
|
11
12
|
export class RelayUpstream {
|
|
12
13
|
config;
|
|
13
14
|
onClientEvent;
|
|
15
|
+
onConnect;
|
|
14
16
|
socket = null;
|
|
15
|
-
constructor(config, onClientEvent) {
|
|
17
|
+
constructor(config, onClientEvent, onConnect) {
|
|
16
18
|
this.config = config;
|
|
17
19
|
this.onClientEvent = onClientEvent;
|
|
20
|
+
this.onConnect = onConnect;
|
|
18
21
|
}
|
|
19
22
|
registerPairing() {
|
|
20
23
|
if (!this.socket?.connected)
|
|
@@ -51,14 +54,22 @@ export class RelayUpstream {
|
|
|
51
54
|
role: 'connector',
|
|
52
55
|
token: this.config.relayToken,
|
|
53
56
|
roomId: this.config.relayRoomId,
|
|
57
|
+
clientKind: 'connector',
|
|
58
|
+
clientVersion: connectorClientVersion(),
|
|
54
59
|
},
|
|
55
60
|
});
|
|
56
61
|
this.socket.on('connect', () => {
|
|
57
62
|
console.log(`[relay-upstream] connected to ${url} room=${this.config.relayRoomId}`);
|
|
58
63
|
this.registerPairing();
|
|
64
|
+
this.onConnect?.();
|
|
59
65
|
});
|
|
60
66
|
this.socket.on('connect_error', (err) => {
|
|
61
|
-
|
|
67
|
+
const v = connectorClientVersion();
|
|
68
|
+
console.warn(`[relay-upstream] connect_error: ${err.message} (clientVersion=${v})`);
|
|
69
|
+
if (String(err.message).includes('CLI_VERSION_OUTDATED') ||
|
|
70
|
+
String(err.message).includes('CLI_VERSION_MISSING')) {
|
|
71
|
+
console.warn('[relay-upstream] Обновите cursorconnect: npm install -g cursorconnect@latest && cursorconnect start');
|
|
72
|
+
}
|
|
62
73
|
});
|
|
63
74
|
this.socket.on('disconnect', (reason) => {
|
|
64
75
|
console.log('[relay-upstream] disconnected:', reason);
|
|
@@ -23,14 +23,33 @@ export declare class Relay {
|
|
|
23
23
|
private io;
|
|
24
24
|
private tokens;
|
|
25
25
|
private upstream;
|
|
26
|
+
private agentCompletionPush;
|
|
27
|
+
private readonly pendingPushPayloads;
|
|
26
28
|
private readonly chatDisplay;
|
|
29
|
+
/** Raw JSONL row count last sent per agent (live `append` emits). */
|
|
30
|
+
private readonly lastEmittedJsonlRows;
|
|
27
31
|
constructor(config: ServerConfig, stateManager: StateManager, commandExecutor: CommandExecutor, cdpBridge: CDPBridge, jsonlIndex: JsonlIndex, messageDebugStore: MessageDebugStore, domExtractor: DOMExtractor);
|
|
32
|
+
private emitAgentCompletedPush;
|
|
33
|
+
private flushPendingPushPayloads;
|
|
34
|
+
private observeAgentCompletionForPush;
|
|
28
35
|
listen(): Promise<void>;
|
|
29
36
|
private get authEnabled();
|
|
37
|
+
/** Read-only view of in-memory bridge state (no writes to stores). */
|
|
38
|
+
private readOnlyChatSnapshot;
|
|
39
|
+
/** Push JSONL file updates to every subscribed route id (e.g. sidebar-0) for that composer. */
|
|
40
|
+
private syncJsonlToSubscribedAgents;
|
|
41
|
+
/** Live JSONL: push display deltas to app; `totalMessages` = raw `.jsonl` line count. */
|
|
42
|
+
private emitJsonlLiveForAgent;
|
|
43
|
+
/** Client lenta: JSONL only (`liveMessages` always empty). DOM stays in debug snapshot. */
|
|
44
|
+
private agentMessagesSnapshot;
|
|
30
45
|
private checkMediaAuth;
|
|
31
46
|
private setupHttp;
|
|
32
47
|
private setupSocket;
|
|
33
48
|
private broadcast;
|
|
49
|
+
private historySeqByAgent;
|
|
50
|
+
private nextHistorySeq;
|
|
51
|
+
private emitAgentMessages;
|
|
52
|
+
/** DOM messages in state:patch — debug/UI chrome only; chat lenta is JSONL via agent:messages. */
|
|
34
53
|
private prepareStateMessages;
|
|
35
54
|
private withDisplayState;
|
|
36
55
|
private wireEvents;
|
|
@@ -44,6 +63,8 @@ export declare class Relay {
|
|
|
44
63
|
private runCommand;
|
|
45
64
|
private runAgentsHistory;
|
|
46
65
|
private runAgentsSubscribe;
|
|
66
|
+
/** Открытие чата: JSONL baseline + focus/scroll (DOM poll только для state: working/approve). */
|
|
67
|
+
private refreshDomChatOnSubscribe;
|
|
47
68
|
private runAgentsUnsubscribe;
|
|
48
69
|
private runAgentsFocus;
|
|
49
70
|
}
|