cursorconnect 0.1.7 → 0.1.9

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.
Files changed (44) hide show
  1. package/bridge-runtime/.env.example +7 -1
  2. package/bridge-runtime/connector-version.json +1 -1
  3. package/bridge-runtime/dist/agent-completion-push.d.ts +27 -22
  4. package/bridge-runtime/dist/agent-completion-push.js +242 -122
  5. package/bridge-runtime/dist/agent-completion-readiness.d.ts +19 -0
  6. package/bridge-runtime/dist/agent-completion-readiness.js +42 -0
  7. package/bridge-runtime/dist/chat-display-store.d.ts +32 -7
  8. package/bridge-runtime/dist/chat-display-store.js +99 -21
  9. package/bridge-runtime/dist/chat-display.d.ts +36 -0
  10. package/bridge-runtime/dist/chat-display.js +287 -24
  11. package/bridge-runtime/dist/chat-sync.d.ts +3 -1
  12. package/bridge-runtime/dist/chat-sync.js +20 -0
  13. package/bridge-runtime/dist/config.js +2 -0
  14. package/bridge-runtime/dist/connector-client-version.js +1 -1
  15. package/bridge-runtime/dist/debug-chats-page.d.ts +1 -1
  16. package/bridge-runtime/dist/debug-chats-page.js +148 -26
  17. package/bridge-runtime/dist/dom-transcript-store.d.ts +3 -1
  18. package/bridge-runtime/dist/dom-transcript-store.js +18 -3
  19. package/bridge-runtime/dist/extract-page.js +5 -4
  20. package/bridge-runtime/dist/index.js +9 -0
  21. package/bridge-runtime/dist/keep-awake.d.ts +5 -0
  22. package/bridge-runtime/dist/keep-awake.js +48 -0
  23. package/bridge-runtime/dist/lenta-capture.d.ts +46 -0
  24. package/bridge-runtime/dist/lenta-capture.js +146 -0
  25. package/bridge-runtime/dist/lenta-debug.d.ts +42 -0
  26. package/bridge-runtime/dist/lenta-debug.js +221 -0
  27. package/bridge-runtime/dist/lenta-delivery.d.ts +3 -0
  28. package/bridge-runtime/dist/lenta-delivery.js +10 -0
  29. package/bridge-runtime/dist/lenta-seq-journal.d.ts +48 -0
  30. package/bridge-runtime/dist/lenta-seq-journal.js +109 -0
  31. package/bridge-runtime/dist/message-filter.d.ts +5 -0
  32. package/bridge-runtime/dist/message-filter.js +4 -0
  33. package/bridge-runtime/dist/relay-upstream.d.ts +3 -0
  34. package/bridge-runtime/dist/relay-upstream.js +21 -0
  35. package/bridge-runtime/dist/relay.d.ts +47 -3
  36. package/bridge-runtime/dist/relay.js +667 -96
  37. package/bridge-runtime/dist/types.d.ts +13 -4
  38. package/dist/bridge-build.js +50 -0
  39. package/dist/index.js +9 -6
  40. package/dist/launch.js +5 -1
  41. package/dist/run-service.js +10 -4
  42. package/dist/startup-check.js +6 -0
  43. package/package.json +1 -1
  44. package/version-policy.json +2 -2
@@ -9,6 +9,11 @@ export declare const WORKING_STATUS_LINE: RegExp;
9
9
  /** Short DOM status line only — not a sentence inside a chat message. */
10
10
  export declare function matchBackgroundWorkStatusText(text: string): string | undefined;
11
11
  export declare function isBackgroundWorkStatusText(text: string): boolean;
12
+ /** Paused for background shell — not active generation (no list spinner / agentWorking). */
13
+ export declare function isPassiveBackgroundShellState(state: {
14
+ agentStatus?: string;
15
+ agentWorking?: boolean;
16
+ }): boolean;
12
17
  /** Chat line that is only passive-work status (not prose mentioning it). */
13
18
  export declare function isPassiveStatusChatLine(text: string): boolean;
14
19
  /** DOM/system lines that mean the agent is still busy */
@@ -22,6 +22,10 @@ export function matchBackgroundWorkStatusText(text) {
22
22
  export function isBackgroundWorkStatusText(text) {
23
23
  return matchBackgroundWorkStatusText(text) !== undefined;
24
24
  }
25
+ /** Paused for background shell — not active generation (no list spinner / agentWorking). */
26
+ export function isPassiveBackgroundShellState(state) {
27
+ return (state.agentStatus === AGENT_STATUS_BACKGROUND_SHELL && state.agentWorking !== true);
28
+ }
25
29
  /** Chat line that is only passive-work status (not prose mentioning it). */
26
30
  export function isPassiveStatusChatLine(text) {
27
31
  const t = text.trim().replace(/\s+/g, ' ');
@@ -5,9 +5,12 @@ export declare class RelayUpstream {
5
5
  private onClientEvent;
6
6
  private onConnect?;
7
7
  private socket;
8
+ private keepaliveTimer;
8
9
  constructor(config: ServerConfig, onClientEvent: UpstreamCommandHandler, onConnect?: (() => void) | undefined);
9
10
  private registerPairing;
10
11
  connect(): void;
12
+ private startKeepalive;
13
+ private stopKeepalive;
11
14
  emit(event: string, ...args: unknown[]): void;
12
15
  get connected(): boolean;
13
16
  private handleHttpProxy;
@@ -14,6 +14,7 @@ export class RelayUpstream {
14
14
  onClientEvent;
15
15
  onConnect;
16
16
  socket = null;
17
+ keepaliveTimer = null;
17
18
  constructor(config, onClientEvent, onConnect) {
18
19
  this.config = config;
19
20
  this.onClientEvent = onClientEvent;
@@ -85,6 +86,26 @@ export class RelayUpstream {
85
86
  this.socket.on('relay:http', (req) => {
86
87
  void this.handleHttpProxy(req);
87
88
  });
89
+ this.startKeepalive();
90
+ }
91
+ startKeepalive() {
92
+ this.stopKeepalive();
93
+ const ms = this.config.relayKeepaliveMs;
94
+ if (!this.config.relayUrl || ms <= 0)
95
+ return;
96
+ this.keepaliveTimer = setInterval(() => {
97
+ if (!this.socket?.connected)
98
+ return;
99
+ this.socket.emit('relay:connector-ping', {
100
+ roomId: this.config.relayRoomId,
101
+ ts: Date.now(),
102
+ });
103
+ }, ms);
104
+ }
105
+ stopKeepalive() {
106
+ if (this.keepaliveTimer)
107
+ clearInterval(this.keepaliveTimer);
108
+ this.keepaliveTimer = null;
88
109
  }
89
110
  emit(event, ...args) {
90
111
  if (this.socket?.connected)
@@ -28,19 +28,53 @@ export declare class Relay {
28
28
  private readonly chatDisplay;
29
29
  /** Raw JSONL row count last sent per agent (live `append` emits). */
30
30
  private readonly lastEmittedJsonlRows;
31
+ /** Last display tail pushed to app — re-emit when user/assistant tail changes. */
32
+ private readonly lastEmittedLentaSig;
33
+ /** Display bubble count last sent — block regression 214→74 style wipes on phone. */
34
+ private readonly lastEmittedHistLen;
35
+ private readonly lentaPendingSince;
36
+ private static readonly LENTA_PENDING_FORCE_MS;
37
+ /** Socket `agent:messages` coalesce — store ingest is immediate (see ingestDomOverlayFromState). */
38
+ private static readonly DOM_OVERLAY_EMIT_MS;
39
+ private domOverlayTimer;
40
+ private cachedLentaPendingByAgent;
31
41
  constructor(config: ServerConfig, stateManager: StateManager, commandExecutor: CommandExecutor, cdpBridge: CDPBridge, jsonlIndex: JsonlIndex, messageDebugStore: MessageDebugStore, domExtractor: DOMExtractor);
32
42
  private emitAgentCompletedPush;
33
43
  private flushPendingPushPayloads;
34
44
  private observeAgentCompletionForPush;
45
+ private requestAgentCompletionContentSync;
35
46
  listen(): Promise<void>;
36
47
  private get authEnabled();
48
+ private lentaAgentIds;
37
49
  /** Read-only view of in-memory bridge state (no writes to stores). */
38
50
  private readOnlyChatSnapshot;
51
+ private buildLentaDebugReport;
39
52
  /** Push JSONL file updates to every subscribed route id (e.g. sidebar-0) for that composer. */
40
53
  private syncJsonlToSubscribedAgents;
41
- /** Live JSONL: push display deltas to app; `totalMessages` = raw `.jsonl` line count. */
54
+ /** JSONL baseline + DOM tail (`liveMessages`); `messages` = append-only compose. */
55
+ private lentaSnapshot;
56
+ private emitLentaForAgent;
57
+ private lentaTailSignature;
58
+ /** Live JSONL → `agent:messages` for subscribed chats (phone lenta). */
42
59
  private emitJsonlLiveForAgent;
43
- /** Client lenta: JSONL only (`liveMessages` always empty). DOM stays in debug snapshot. */
60
+ /** Ingest CDP viewport into ChatDisplayStore no debounce (debug + compose). */
61
+ private ingestDomOverlayFromState;
62
+ /** Push lenta with DOM live to clients while generation is in flight. */
63
+ private emitDomLiveWhileGenerating;
64
+ private syncGeneratingFlags;
65
+ /** Push composed lenta to subscribed clients (debounced). */
66
+ private emitDomOverlaySocketForSubscribers;
67
+ /** While generating, push overlay growth without waiting for emit debounce tail. */
68
+ private maybeEmitDomOverlayLeading;
69
+ private applyDomOverlayFromState;
70
+ private scheduleDomOverlayEmit;
71
+ /**
72
+ * Agent ids that should receive DOM ingest: active Cursor composer + synced subscriptions.
73
+ * Store must update even without phone subscribe (debug/lenta, later subscribe).
74
+ */
75
+ private resolveDomOverlayAgentIds;
76
+ private writeLentaCapture;
77
+ private resolveHistoryOpts;
44
78
  private agentMessagesSnapshot;
45
79
  private checkMediaAuth;
46
80
  private setupHttp;
@@ -49,9 +83,17 @@ export declare class Relay {
49
83
  private historySeqByAgent;
50
84
  private nextHistorySeq;
51
85
  private emitAgentMessages;
52
- /** DOM messages in state:patch — debug/UI chrome only; chat lenta is JSONL via agent:messages. */
53
86
  private prepareStateMessages;
54
87
  private withDisplayState;
88
+ private buildLentaPendingByAgent;
89
+ private refreshLentaPendingCache;
90
+ private withRelayState;
91
+ private refreshLentaPendingPatch;
92
+ private noteLentaDelivery;
93
+ /** Push `agent:messages` when store is ahead of last emit (subscribed + synced). */
94
+ private flushLentaDelivery;
95
+ private flushPendingLentaForSubscribers;
96
+ private maybeForceStaleLentaDelivery;
55
97
  private wireEvents;
56
98
  private emitAgentsIndex;
57
99
  private refreshAgentsIndex;
@@ -63,6 +105,8 @@ export declare class Relay {
63
105
  private runCommand;
64
106
  private runAgentsHistory;
65
107
  private runAgentsSubscribe;
108
+ /** Load JSONL into store when DOM ingest runs but baseline empty (e.g. after bridge restart). */
109
+ private ensureJsonlBaselineForAgent;
66
110
  /** Открытие чата: JSONL baseline + focus/scroll (DOM poll только для state: working/approve). */
67
111
  private refreshDomChatOnSubscribe;
68
112
  private runAgentsUnsubscribe;