@zonease/happy 0.6.41 → 0.6.43
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/dist/{api-XeHlmApX.cjs → api-B-PlVQY6.cjs} +50 -4
- package/dist/{api-K2-jr9ar.mjs → api-BUCtd3cB.mjs} +51 -5
- package/dist/{auth-BQvEuSs5.cjs → auth-BqGkUXvq.cjs} +2 -2
- package/dist/{auth-CjLkoM3m.mjs → auth-DQH6q_q-.mjs} +4 -4
- package/dist/{auth-BbvPcnkY.cjs → auth-OL3nNcDX.cjs} +4 -4
- package/dist/{auth-DS8fzlin.mjs → auth-qM2eojWx.mjs} +2 -2
- package/dist/{browser-C05SP_Tt.cjs → browser-CY7VNU0C.cjs} +1 -1
- package/dist/{browser-C05Ak6RL.mjs → browser-D5RN_Axa.mjs} +1 -1
- package/dist/{claudeLocal-DJNRlHIC.mjs → claudeLocal-BXK_vQXS.mjs} +1 -1
- package/dist/{claudeLocal-CpDhLCcZ.cjs → claudeLocal-HAXk0deK.cjs} +1 -1
- package/dist/{config-DWWtjKQx.mjs → config-2wMjzcHl.mjs} +1 -1
- package/dist/{config-B0mns9fF.cjs → config-CaKxWGVe.cjs} +1 -1
- package/dist/{connect-DXQC1CJe.mjs → connect-BAunPyp_.mjs} +5 -5
- package/dist/{connect-BxCScVNX.cjs → connect-Dt1vY1BC.cjs} +5 -5
- package/dist/{controlClient-DgjVRN8D.mjs → controlClient-BzzTNSfl.mjs} +1 -1
- package/dist/{controlClient-DgELDZgM.cjs → controlClient-yTkpwcOq.cjs} +1 -1
- package/dist/cursorApprovalHook-B2chnVni.cjs +115 -0
- package/dist/cursorApprovalHook-BDLPzI5l.mjs +113 -0
- package/dist/cursorApprovalServer-Ba1yOUCA.mjs +263 -0
- package/dist/cursorApprovalServer-xwxVGL3u.cjs +268 -0
- package/dist/{deviceKeys-CejCdWpw.mjs → deviceKeys-CQyFFPtt.mjs} +2 -2
- package/dist/{deviceKeys-BpIAWz13.cjs → deviceKeys-CdW-HPnz.cjs} +2 -2
- package/dist/{doctor-DznasgP3.cjs → doctor-D4xWXiE7.cjs} +2 -2
- package/dist/{doctor-B-LCMVN9.mjs → doctor-DDT2TXHH.mjs} +2 -2
- package/dist/downloadImage-3A6zY5AX.cjs +492 -0
- package/dist/downloadImage-BqNp0l7y.mjs +485 -0
- package/dist/{enroll-HjUqyGnD.mjs → enroll-BlZ0giJI.mjs} +3 -3
- package/dist/{enroll-BvfpRUGJ.cjs → enroll-DeYs89Ic.cjs} +3 -3
- package/dist/{evidence-CVgTjBrq.cjs → evidence-Bn1JXtdz.cjs} +1 -1
- package/dist/{evidence-BEQd1dCh.mjs → evidence-PUnN9yPK.mjs} +1 -1
- package/dist/{formatImageMessage-DVs57t3x.mjs → formatImageMessage-BRHeLf0-.mjs} +1 -1
- package/dist/{formatImageMessage-CmJTP_hU.cjs → formatImageMessage-bVFGFDJl.cjs} +1 -1
- package/dist/{index-CDTNgfUf.cjs → index-BeKrqPYR.cjs} +25 -1
- package/dist/{index-CPKdvi7J.mjs → index-DTV7drqs.mjs} +25 -1
- package/dist/index.cjs +95 -41
- package/dist/index.mjs +95 -41
- package/dist/{install-UTz_vYvB.mjs → install-BLPNuSeM.mjs} +2 -2
- package/dist/{install-B3mMGISS.mjs → install-BOIcR_Wr.mjs} +1 -1
- package/dist/{install-Ck22tYHP.cjs → install-Jrs6YUu8.cjs} +1 -1
- package/dist/{install-2Yl_L582.cjs → install-Q-YMwwwg.cjs} +2 -2
- package/dist/lib.cjs +4 -4
- package/dist/lib.d.cts +4 -2
- package/dist/lib.d.mts +4 -2
- package/dist/lib.mjs +4 -4
- package/dist/{loadableToolOutput-BZYlaqHn.cjs → loadableToolOutput-B3qpMqXT.cjs} +2 -458
- package/dist/{loadableToolOutput-4EvraaNY.mjs → loadableToolOutput-DzReWITb.mjs} +3 -456
- package/dist/{persistence-DrfN7TzY.cjs → persistence-D7zNFI-d.cjs} +7 -4
- package/dist/{persistence-CIUFyOwz.mjs → persistence-DbLMvLvk.mjs} +7 -4
- package/dist/{push-CCOXCcM_.cjs → push-RT6Y0Hr3.cjs} +6 -6
- package/dist/{push-USXj_pv0.mjs → push-z5wQ4Ki_.mjs} +6 -6
- package/dist/{downloadImage-ia5SzlCV.mjs → registerKillSessionHandler-DmfnJ0zq.mjs} +7 -487
- package/dist/{downloadImage-B_ygLAXY.cjs → registerKillSessionHandler-MoLdSQxM.cjs} +6 -492
- package/dist/{run-Dy6KX6m-.mjs → run-BFnSUK1o.mjs} +14 -9
- package/dist/{run-D3CopmEb.cjs → run-C5StYRIB.cjs} +14 -9
- package/dist/{runClaude-aHzvx6Ha.cjs → runClaude-ChRp6f5G.cjs} +27 -26
- package/dist/{runClaude-CWux2RDq.mjs → runClaude-CjENBdrX.mjs} +22 -21
- package/dist/{runCodex-D0ZxSj3O.mjs → runCodex-BzQWlRoj.mjs} +27 -25
- package/dist/{runCodex-G-Aq531U.cjs → runCodex-DcQGyotH.cjs} +32 -30
- package/dist/runCursor-B73z6MCN.mjs +752 -0
- package/dist/runCursor-BlPAxaTy.cjs +754 -0
- package/dist/{runGemini-DZC2i6vA.mjs → runGemini-BPv4UzuF.mjs} +18 -16
- package/dist/{runGemini-DxGgDAIM.cjs → runGemini-JFqaIC3u.cjs} +23 -21
- package/dist/{runOneShot-BgT-JNMA.cjs → runOneShot-2iV11e9L.cjs} +3 -3
- package/dist/{runOneShot-cxlk7VKA.mjs → runOneShot-DTukim2A.mjs} +3 -3
- package/dist/{serve-Dr3wPrtK.cjs → serve-BDwuAIK4.cjs} +7 -7
- package/dist/{serve-CKyvJNs0.mjs → serve-BnlYj5ek.mjs} +7 -7
- package/dist/{session-dYzbOo_W.cjs → session-Cp9LEESM.cjs} +5 -5
- package/dist/{session-vf2ZjFto.mjs → session-gfeFU8CA.mjs} +5 -5
- package/dist/{sessionKeyCache-dDquDzn0.cjs → sessionKeyCache-3Pme04yL.cjs} +1 -1
- package/dist/{sessionKeyCache-D2u3JUys.mjs → sessionKeyCache-DtBS_Sb3.mjs} +1 -1
- package/dist/{sessionList-C1k2PNg_.mjs → sessionList-B1w4BUdv.mjs} +2 -2
- package/dist/{sessionList-DmmtC7uR.cjs → sessionList-BR_5UDZJ.cjs} +2 -2
- package/dist/{sessionSummary-DGLoVOxd.cjs → sessionSummary-DLweYgHO.cjs} +3 -3
- package/dist/{sessionSummary-5a1QtFVS.mjs → sessionSummary-E-a2bg8W.mjs} +3 -3
- package/dist/setupOfflineReconnection-DHwthFtd.mjs +459 -0
- package/dist/setupOfflineReconnection-Dkp00dC9.cjs +463 -0
- package/dist/{spawnHappyCLI-CarRI4GM.cjs → spawnHappyCLI-C2uY9WV-.cjs} +1 -1
- package/dist/{spawnHappyCLI-D3EkTFIn.mjs → spawnHappyCLI-Dt7fbmbk.mjs} +1 -1
- package/dist/{ssh-B0hvEYIl.mjs → ssh-C-nEZiGP.mjs} +5 -5
- package/dist/{ssh-CBgVwKsB.cjs → ssh-CsnS89Lr.cjs} +5 -5
- package/dist/{task-CRo6W-3_.mjs → task-B-8_QGGX.mjs} +6 -6
- package/dist/{task-CMunPKCV.cjs → task-lrLb4FCL.cjs} +6 -6
- package/dist/{uninstall-BALE2up0.mjs → uninstall-CirMt_WC.mjs} +2 -2
- package/dist/{uninstall-BJ3eEGM4.cjs → uninstall-DMjUlEXT.cjs} +2 -2
- package/dist/{update-BfjtLrhO.mjs → update-CfXbYshs.mjs} +3 -3
- package/dist/{update-Bb3iijy8.cjs → update-mx2p28IP.cjs} +3 -3
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var axios = require('axios');
|
|
4
|
-
var logger = require('./persistence-
|
|
4
|
+
var logger = require('./persistence-D7zNFI-d.cjs');
|
|
5
5
|
var node_events = require('node:events');
|
|
6
6
|
var socket_ioClient = require('socket.io-client');
|
|
7
7
|
var z = require('zod');
|
|
8
|
-
require('./index-
|
|
8
|
+
require('./index-BeKrqPYR.cjs');
|
|
9
9
|
var time = require('./time-Bj2HRkKH.cjs');
|
|
10
10
|
var node_crypto = require('node:crypto');
|
|
11
11
|
var fs = require('node:fs');
|
|
@@ -26,7 +26,7 @@ var tweetnacl = require('tweetnacl');
|
|
|
26
26
|
var base64 = require('@stablelib/base64');
|
|
27
27
|
var node_readline = require('node:readline');
|
|
28
28
|
var expoServerSdk = require('expo-server-sdk');
|
|
29
|
-
var sessionKeyCache = require('./sessionKeyCache-
|
|
29
|
+
var sessionKeyCache = require('./sessionKeyCache-3Pme04yL.cjs');
|
|
30
30
|
var chalk = require('chalk');
|
|
31
31
|
|
|
32
32
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
@@ -1395,7 +1395,7 @@ function resolveToolsDir() {
|
|
|
1395
1395
|
}
|
|
1396
1396
|
function findToolsDir() {
|
|
1397
1397
|
try {
|
|
1398
|
-
const manifest = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('api-
|
|
1398
|
+
const manifest = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('api-B-PlVQY6.cjs', document.baseURI).href))).resolve(`${toolsPackageName()}/package.json`);
|
|
1399
1399
|
return path.dirname(manifest);
|
|
1400
1400
|
} catch {
|
|
1401
1401
|
}
|
|
@@ -6036,6 +6036,45 @@ async function forkAndTruncateCodexSession(codexSessionId, truncateBeforeUuid) {
|
|
|
6036
6036
|
}
|
|
6037
6037
|
}
|
|
6038
6038
|
|
|
6039
|
+
function chatsRoot() {
|
|
6040
|
+
return path.join(os.homedir(), ".cursor", "chats");
|
|
6041
|
+
}
|
|
6042
|
+
async function findChatDirectory(chatId) {
|
|
6043
|
+
const root = chatsRoot();
|
|
6044
|
+
if (!fs.existsSync(root)) return null;
|
|
6045
|
+
let workspaces;
|
|
6046
|
+
try {
|
|
6047
|
+
workspaces = await promises.readdir(root);
|
|
6048
|
+
} catch {
|
|
6049
|
+
return null;
|
|
6050
|
+
}
|
|
6051
|
+
for (const workspace of workspaces) {
|
|
6052
|
+
const candidate = path.join(root, workspace, chatId);
|
|
6053
|
+
try {
|
|
6054
|
+
if ((await promises.stat(candidate)).isDirectory()) return candidate;
|
|
6055
|
+
} catch {
|
|
6056
|
+
}
|
|
6057
|
+
}
|
|
6058
|
+
return null;
|
|
6059
|
+
}
|
|
6060
|
+
async function forkCursorSession(chatId) {
|
|
6061
|
+
const source = await findChatDirectory(chatId);
|
|
6062
|
+
if (!source) {
|
|
6063
|
+
return { success: false, errorMessage: `Cursor chat not found: ${chatId}` };
|
|
6064
|
+
}
|
|
6065
|
+
const newChatId = node_crypto.randomUUID();
|
|
6066
|
+
const destination = path.join(source, "..", newChatId);
|
|
6067
|
+
try {
|
|
6068
|
+
await promises.cp(source, destination, { recursive: true });
|
|
6069
|
+
logger.logger.debug(`[cursor] forked chat ${chatId} \u2192 ${newChatId}`);
|
|
6070
|
+
return { success: true, newChatId };
|
|
6071
|
+
} catch (error) {
|
|
6072
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6073
|
+
logger.logger.debug(`[cursor] fork failed for ${chatId}: ${message}`);
|
|
6074
|
+
return { success: false, errorMessage: message };
|
|
6075
|
+
}
|
|
6076
|
+
}
|
|
6077
|
+
|
|
6039
6078
|
class SessionCache {
|
|
6040
6079
|
data = null;
|
|
6041
6080
|
loadingPromise = null;
|
|
@@ -6606,6 +6645,13 @@ class ApiMachineClient {
|
|
|
6606
6645
|
}
|
|
6607
6646
|
return await forkCodexSession(codexSessionId);
|
|
6608
6647
|
});
|
|
6648
|
+
this.rpcHandlerManager.registerHandler("cursor-fork-session", async (params) => {
|
|
6649
|
+
const { cursorSessionId } = params || {};
|
|
6650
|
+
if (!cursorSessionId || typeof cursorSessionId !== "string") {
|
|
6651
|
+
throw new Error("cursorSessionId is required");
|
|
6652
|
+
}
|
|
6653
|
+
return await forkCursorSession(cursorSessionId);
|
|
6654
|
+
});
|
|
6609
6655
|
this.rpcHandlerManager.registerHandler("gemini-list-sessions", async (params) => {
|
|
6610
6656
|
const offset = typeof params?.offset === "number" && params.offset >= 0 ? Math.floor(params.offset) : 0;
|
|
6611
6657
|
const limit = typeof params?.limit === "number" && params.limit > 0 ? Math.floor(params.limit) : 50;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import axios from 'axios';
|
|
2
|
-
import { l as logger, c as configuration, e as encodeBase64, f as encrypt, g as decrypt, h as decodeBase64, i as isDebug, B as encryptLegacy, a as readSettings, C as getRandomBytes, D as libsodiumEncryptForPublicKey } from './persistence-
|
|
2
|
+
import { l as logger, c as configuration, e as encodeBase64, f as encrypt, g as decrypt, h as decodeBase64, i as isDebug, B as encryptLegacy, a as readSettings, C as getRandomBytes, D as libsodiumEncryptForPublicKey } from './persistence-DbLMvLvk.mjs';
|
|
3
3
|
import { EventEmitter } from 'node:events';
|
|
4
4
|
import { io } from 'socket.io-client';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-DTV7drqs.mjs';
|
|
7
7
|
import { b as backoff, e as exponentialBackoffDelay } from './time-DgsBLJA_.mjs';
|
|
8
8
|
import { randomUUID, createHash } from 'node:crypto';
|
|
9
9
|
import fs, { existsSync, readFileSync, writeFileSync, mkdirSync, statSync, readdirSync, mkdtempSync, chmodSync, createReadStream, createWriteStream, unlink as unlink$2, rmdirSync } from 'node:fs';
|
|
10
10
|
import path, { join, dirname, resolve as resolve$1, basename } from 'node:path';
|
|
11
11
|
import { spawn, execFile, execSync, execFileSync } from 'node:child_process';
|
|
12
|
-
import { readFile, rm, open, writeFile as writeFile$1, rename as rename$1, unlink as unlink$1, stat as stat$1, readdir as readdir$1, copyFile, mkdir as mkdir$1, appendFile as appendFile$1 } from 'node:fs/promises';
|
|
12
|
+
import { readFile, rm, open, writeFile as writeFile$1, rename as rename$1, unlink as unlink$1, stat as stat$1, readdir as readdir$1, copyFile, mkdir as mkdir$1, appendFile as appendFile$1, cp } from 'node:fs/promises';
|
|
13
13
|
import os, { tmpdir, homedir } from 'node:os';
|
|
14
14
|
import { promisify } from 'node:util';
|
|
15
15
|
import { spawn as spawn$1, exec } from 'child_process';
|
|
@@ -24,7 +24,7 @@ import tweetnacl from 'tweetnacl';
|
|
|
24
24
|
import { encode, decode } from '@stablelib/base64';
|
|
25
25
|
import { createInterface } from 'node:readline';
|
|
26
26
|
import { Expo } from 'expo-server-sdk';
|
|
27
|
-
import { c as cacheSessionKey } from './sessionKeyCache-
|
|
27
|
+
import { c as cacheSessionKey } from './sessionKeyCache-DtBS_Sb3.mjs';
|
|
28
28
|
import chalk from 'chalk';
|
|
29
29
|
|
|
30
30
|
z.object({
|
|
@@ -6033,6 +6033,45 @@ async function forkAndTruncateCodexSession(codexSessionId, truncateBeforeUuid) {
|
|
|
6033
6033
|
}
|
|
6034
6034
|
}
|
|
6035
6035
|
|
|
6036
|
+
function chatsRoot() {
|
|
6037
|
+
return join(homedir(), ".cursor", "chats");
|
|
6038
|
+
}
|
|
6039
|
+
async function findChatDirectory(chatId) {
|
|
6040
|
+
const root = chatsRoot();
|
|
6041
|
+
if (!existsSync(root)) return null;
|
|
6042
|
+
let workspaces;
|
|
6043
|
+
try {
|
|
6044
|
+
workspaces = await readdir$1(root);
|
|
6045
|
+
} catch {
|
|
6046
|
+
return null;
|
|
6047
|
+
}
|
|
6048
|
+
for (const workspace of workspaces) {
|
|
6049
|
+
const candidate = join(root, workspace, chatId);
|
|
6050
|
+
try {
|
|
6051
|
+
if ((await stat$1(candidate)).isDirectory()) return candidate;
|
|
6052
|
+
} catch {
|
|
6053
|
+
}
|
|
6054
|
+
}
|
|
6055
|
+
return null;
|
|
6056
|
+
}
|
|
6057
|
+
async function forkCursorSession(chatId) {
|
|
6058
|
+
const source = await findChatDirectory(chatId);
|
|
6059
|
+
if (!source) {
|
|
6060
|
+
return { success: false, errorMessage: `Cursor chat not found: ${chatId}` };
|
|
6061
|
+
}
|
|
6062
|
+
const newChatId = randomUUID();
|
|
6063
|
+
const destination = join(source, "..", newChatId);
|
|
6064
|
+
try {
|
|
6065
|
+
await cp(source, destination, { recursive: true });
|
|
6066
|
+
logger.debug(`[cursor] forked chat ${chatId} \u2192 ${newChatId}`);
|
|
6067
|
+
return { success: true, newChatId };
|
|
6068
|
+
} catch (error) {
|
|
6069
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6070
|
+
logger.debug(`[cursor] fork failed for ${chatId}: ${message}`);
|
|
6071
|
+
return { success: false, errorMessage: message };
|
|
6072
|
+
}
|
|
6073
|
+
}
|
|
6074
|
+
|
|
6036
6075
|
class SessionCache {
|
|
6037
6076
|
data = null;
|
|
6038
6077
|
loadingPromise = null;
|
|
@@ -6603,6 +6642,13 @@ class ApiMachineClient {
|
|
|
6603
6642
|
}
|
|
6604
6643
|
return await forkCodexSession(codexSessionId);
|
|
6605
6644
|
});
|
|
6645
|
+
this.rpcHandlerManager.registerHandler("cursor-fork-session", async (params) => {
|
|
6646
|
+
const { cursorSessionId } = params || {};
|
|
6647
|
+
if (!cursorSessionId || typeof cursorSessionId !== "string") {
|
|
6648
|
+
throw new Error("cursorSessionId is required");
|
|
6649
|
+
}
|
|
6650
|
+
return await forkCursorSession(cursorSessionId);
|
|
6651
|
+
});
|
|
6606
6652
|
this.rpcHandlerManager.registerHandler("gemini-list-sessions", async (params) => {
|
|
6607
6653
|
const offset = typeof params?.offset === "number" && params.offset >= 0 ? Math.floor(params.offset) : 0;
|
|
6608
6654
|
const limit = typeof params?.limit === "number" && params.limit > 0 ? Math.floor(params.limit) : 50;
|
|
@@ -7456,4 +7502,4 @@ var api = /*#__PURE__*/Object.freeze({
|
|
|
7456
7502
|
ApiClient: ApiClient
|
|
7457
7503
|
});
|
|
7458
7504
|
|
|
7459
|
-
export { ApiClient as A, GeminiSessionWriter as G, InvalidateSync as I, ApiSessionClient as a,
|
|
7505
|
+
export { ApiClient as A, GeminiSessionWriter as G, InvalidateSync as I, ApiSessionClient as a, startOfflineReconnection as b, saveDiffRecords as c, connectionState as d, extractUserText as e, findCodexSessionFile as f, generateStableUuid as g, readGeminiSessionLog as h, isSystemMessage as i, buildResumeContextFromSessionLog as j, AsyncLock as k, findClaudeProjectId as l, api as m, resolveToolsDir as r, saveToolOutputRecord as s };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var logger = require('./persistence-
|
|
3
|
+
var logger = require('./persistence-D7zNFI-d.cjs');
|
|
4
4
|
var node_crypto = require('node:crypto');
|
|
5
5
|
var tweetnacl = require('tweetnacl');
|
|
6
6
|
var axios = require('axios');
|
|
7
7
|
var qrcode = require('qrcode-terminal');
|
|
8
8
|
var time = require('./time-Bj2HRkKH.cjs');
|
|
9
|
-
var browser = require('./browser-
|
|
9
|
+
var browser = require('./browser-CY7VNU0C.cjs');
|
|
10
10
|
var React = require('react');
|
|
11
11
|
var ink = require('ink');
|
|
12
12
|
require('node:fs/promises');
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import { r as readCredentials, a as readSettings, c as configuration, l as logger, b as clearCredentials, d as clearMachineId } from './persistence-
|
|
3
|
-
import { authAndSetupMachineIfNeeded } from './auth-
|
|
2
|
+
import { r as readCredentials, a as readSettings, c as configuration, l as logger, b as clearCredentials, d as clearMachineId } from './persistence-DbLMvLvk.mjs';
|
|
3
|
+
import { authAndSetupMachineIfNeeded } from './auth-qM2eojWx.mjs';
|
|
4
4
|
import { existsSync, rmSync } from 'node:fs';
|
|
5
5
|
import { createInterface } from 'node:readline';
|
|
6
|
-
import { checkIfDaemonRunningAndCleanupStaleState, stopDaemon } from './controlClient-
|
|
6
|
+
import { checkIfDaemonRunningAndCleanupStaleState, stopDaemon } from './controlClient-BzzTNSfl.mjs';
|
|
7
7
|
import os from 'node:os';
|
|
8
8
|
import 'node:fs/promises';
|
|
9
9
|
import 'node:path';
|
|
@@ -14,7 +14,7 @@ import 'fs';
|
|
|
14
14
|
import 'axios';
|
|
15
15
|
import 'qrcode-terminal';
|
|
16
16
|
import './time-DgsBLJA_.mjs';
|
|
17
|
-
import './browser-
|
|
17
|
+
import './browser-D5RN_Axa.mjs';
|
|
18
18
|
import 'open';
|
|
19
19
|
import 'react';
|
|
20
20
|
import 'ink';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chalk = require('chalk');
|
|
4
|
-
var logger = require('./persistence-
|
|
5
|
-
var auth = require('./auth-
|
|
4
|
+
var logger = require('./persistence-D7zNFI-d.cjs');
|
|
5
|
+
var auth = require('./auth-BqGkUXvq.cjs');
|
|
6
6
|
var fs = require('node:fs');
|
|
7
7
|
var node_readline = require('node:readline');
|
|
8
|
-
var controlClient = require('./controlClient-
|
|
8
|
+
var controlClient = require('./controlClient-yTkpwcOq.cjs');
|
|
9
9
|
var os = require('node:os');
|
|
10
10
|
require('node:fs/promises');
|
|
11
11
|
require('node:path');
|
|
@@ -16,7 +16,7 @@ require('fs');
|
|
|
16
16
|
require('axios');
|
|
17
17
|
require('qrcode-terminal');
|
|
18
18
|
require('./time-Bj2HRkKH.cjs');
|
|
19
|
-
require('./browser-
|
|
19
|
+
require('./browser-CY7VNU0C.cjs');
|
|
20
20
|
require('open');
|
|
21
21
|
require('react');
|
|
22
22
|
require('ink');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { e as encodeBase64, c as configuration, l as logger, r as readCredentials, u as updateSettings, i as isDebug, s as encodeBase64Url, h as decodeBase64, t as writeCredentialsLegacy, w as writeCredentialsDataKey } from './persistence-
|
|
1
|
+
import { e as encodeBase64, c as configuration, l as logger, r as readCredentials, u as updateSettings, i as isDebug, s as encodeBase64Url, h as decodeBase64, t as writeCredentialsLegacy, w as writeCredentialsDataKey } from './persistence-DbLMvLvk.mjs';
|
|
2
2
|
import { randomBytes, randomUUID } from 'node:crypto';
|
|
3
3
|
import tweetnacl from 'tweetnacl';
|
|
4
4
|
import axios from 'axios';
|
|
5
5
|
import qrcode from 'qrcode-terminal';
|
|
6
6
|
import { d as delay } from './time-DgsBLJA_.mjs';
|
|
7
|
-
import { o as openBrowser } from './browser-
|
|
7
|
+
import { o as openBrowser } from './browser-D5RN_Axa.mjs';
|
|
8
8
|
import React, { useState } from 'react';
|
|
9
9
|
import { useInput, Box, Text, render } from 'ink';
|
|
10
10
|
import 'node:fs/promises';
|
|
@@ -3,7 +3,7 @@ import { resolve, join } from 'node:path';
|
|
|
3
3
|
import { createInterface } from 'node:readline';
|
|
4
4
|
import { existsSync, readFileSync, readdirSync, statSync, mkdirSync } from 'node:fs';
|
|
5
5
|
import { randomUUID } from 'node:crypto';
|
|
6
|
-
import { l as logger } from './persistence-
|
|
6
|
+
import { l as logger } from './persistence-DbLMvLvk.mjs';
|
|
7
7
|
import { homedir } from 'node:os';
|
|
8
8
|
import { p as projectPath } from './projectPath-BTBIMB57.mjs';
|
|
9
9
|
import { g as getBaseSystemPrompt } from './prompt-BsAZsPbo.mjs';
|
|
@@ -5,7 +5,7 @@ var path = require('node:path');
|
|
|
5
5
|
var node_readline = require('node:readline');
|
|
6
6
|
var fs = require('node:fs');
|
|
7
7
|
var node_crypto = require('node:crypto');
|
|
8
|
-
var logger = require('./persistence-
|
|
8
|
+
var logger = require('./persistence-D7zNFI-d.cjs');
|
|
9
9
|
var os = require('node:os');
|
|
10
10
|
var projectPath = require('./projectPath-ChLhdOyt.cjs');
|
|
11
11
|
var prompt = require('./prompt-BTWDZZO0.cjs');
|
|
@@ -2,7 +2,7 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import { homedir } from 'os';
|
|
4
4
|
import { execSync } from 'child_process';
|
|
5
|
-
import { l as logger } from './persistence-
|
|
5
|
+
import { l as logger } from './persistence-DbLMvLvk.mjs';
|
|
6
6
|
import { D as DEFAULT_GEMINI_MODEL, G as GEMINI_MODEL_ENV } from './constants-pmXZGibX.mjs';
|
|
7
7
|
import 'node:fs/promises';
|
|
8
8
|
import 'node:fs';
|
|
@@ -4,7 +4,7 @@ var fs = require('fs');
|
|
|
4
4
|
var path = require('path');
|
|
5
5
|
var os = require('os');
|
|
6
6
|
var child_process = require('child_process');
|
|
7
|
-
var logger = require('./persistence-
|
|
7
|
+
var logger = require('./persistence-D7zNFI-d.cjs');
|
|
8
8
|
var constants = require('./constants-E_UWYTo3.cjs');
|
|
9
9
|
require('node:fs/promises');
|
|
10
10
|
require('node:fs');
|
|
@@ -2,11 +2,11 @@ import chalk from 'chalk';
|
|
|
2
2
|
import { existsSync, mkdirSync, writeFileSync } from 'fs';
|
|
3
3
|
import { homedir } from 'os';
|
|
4
4
|
import { join } from 'path';
|
|
5
|
-
import { r as readCredentials } from './persistence-
|
|
6
|
-
import { A as ApiClient } from './api-
|
|
5
|
+
import { r as readCredentials } from './persistence-DbLMvLvk.mjs';
|
|
6
|
+
import { A as ApiClient } from './api-BUCtd3cB.mjs';
|
|
7
7
|
import { createServer } from 'http';
|
|
8
8
|
import { randomBytes, createHash } from 'crypto';
|
|
9
|
-
import { o as openBrowser } from './browser-
|
|
9
|
+
import { o as openBrowser } from './browser-D5RN_Axa.mjs';
|
|
10
10
|
import { exec } from 'child_process';
|
|
11
11
|
import { promisify } from 'util';
|
|
12
12
|
import 'node:fs/promises';
|
|
@@ -19,7 +19,7 @@ import 'tweetnacl';
|
|
|
19
19
|
import 'axios';
|
|
20
20
|
import 'node:events';
|
|
21
21
|
import 'socket.io-client';
|
|
22
|
-
import './index-
|
|
22
|
+
import './index-DTV7drqs.mjs';
|
|
23
23
|
import '@paralleldrive/cuid2';
|
|
24
24
|
import './time-DgsBLJA_.mjs';
|
|
25
25
|
import 'node:child_process';
|
|
@@ -32,7 +32,7 @@ import 'ws';
|
|
|
32
32
|
import '@stablelib/base64';
|
|
33
33
|
import 'node:readline';
|
|
34
34
|
import 'expo-server-sdk';
|
|
35
|
-
import './sessionKeyCache-
|
|
35
|
+
import './sessionKeyCache-DtBS_Sb3.mjs';
|
|
36
36
|
import 'open';
|
|
37
37
|
|
|
38
38
|
const CLIENT_ID$2 = "app_EMoamEEZ73f0CkXaXp7hrann";
|
|
@@ -4,11 +4,11 @@ var chalk = require('chalk');
|
|
|
4
4
|
var fs = require('fs');
|
|
5
5
|
var os = require('os');
|
|
6
6
|
var path = require('path');
|
|
7
|
-
var logger = require('./persistence-
|
|
8
|
-
var api = require('./api-
|
|
7
|
+
var logger = require('./persistence-D7zNFI-d.cjs');
|
|
8
|
+
var api = require('./api-B-PlVQY6.cjs');
|
|
9
9
|
var http = require('http');
|
|
10
10
|
var crypto = require('crypto');
|
|
11
|
-
var browser = require('./browser-
|
|
11
|
+
var browser = require('./browser-CY7VNU0C.cjs');
|
|
12
12
|
var child_process = require('child_process');
|
|
13
13
|
var util = require('util');
|
|
14
14
|
require('node:fs/promises');
|
|
@@ -21,7 +21,7 @@ require('tweetnacl');
|
|
|
21
21
|
require('axios');
|
|
22
22
|
require('node:events');
|
|
23
23
|
require('socket.io-client');
|
|
24
|
-
require('./index-
|
|
24
|
+
require('./index-BeKrqPYR.cjs');
|
|
25
25
|
require('@paralleldrive/cuid2');
|
|
26
26
|
require('./time-Bj2HRkKH.cjs');
|
|
27
27
|
require('node:child_process');
|
|
@@ -34,7 +34,7 @@ require('ws');
|
|
|
34
34
|
require('@stablelib/base64');
|
|
35
35
|
require('node:readline');
|
|
36
36
|
require('expo-server-sdk');
|
|
37
|
-
require('./sessionKeyCache-
|
|
37
|
+
require('./sessionKeyCache-3Pme04yL.cjs');
|
|
38
38
|
require('open');
|
|
39
39
|
|
|
40
40
|
const CLIENT_ID$2 = "app_EMoamEEZ73f0CkXaXp7hrann";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as logger, m as readDaemonState, n as clearDaemonState } from './persistence-
|
|
1
|
+
import { l as logger, m as readDaemonState, n as clearDaemonState } from './persistence-DbLMvLvk.mjs';
|
|
2
2
|
import { p as projectPath } from './projectPath-BTBIMB57.mjs';
|
|
3
3
|
import { readFileSync } from 'fs';
|
|
4
4
|
import { join } from 'path';
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var fs = require('node:fs');
|
|
4
|
+
var path = require('node:path');
|
|
5
|
+
var cursorApprovalServer = require('./cursorApprovalServer-xwxVGL3u.cjs');
|
|
6
|
+
require('node:http');
|
|
7
|
+
require('node:crypto');
|
|
8
|
+
require('node:fs/promises');
|
|
9
|
+
require('node:os');
|
|
10
|
+
require('./persistence-D7zNFI-d.cjs');
|
|
11
|
+
require('zod');
|
|
12
|
+
require('tweetnacl');
|
|
13
|
+
require('chalk');
|
|
14
|
+
require('fs');
|
|
15
|
+
|
|
16
|
+
function readStdin() {
|
|
17
|
+
return new Promise((resolve) => {
|
|
18
|
+
let data = "";
|
|
19
|
+
process.stdin.setEncoding("utf8");
|
|
20
|
+
process.stdin.on("data", (chunk) => {
|
|
21
|
+
data += chunk;
|
|
22
|
+
});
|
|
23
|
+
process.stdin.on("end", () => resolve(data));
|
|
24
|
+
process.stdin.on("error", () => resolve(data));
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function emit(permission, userMessage) {
|
|
28
|
+
const payload = { permission };
|
|
29
|
+
if (userMessage) {
|
|
30
|
+
payload.user_message = userMessage;
|
|
31
|
+
payload.agent_message = userMessage;
|
|
32
|
+
}
|
|
33
|
+
process.stdout.write(`${JSON.stringify(payload)}
|
|
34
|
+
`);
|
|
35
|
+
}
|
|
36
|
+
function isStale(pid) {
|
|
37
|
+
if (typeof pid !== "number") return false;
|
|
38
|
+
try {
|
|
39
|
+
process.kill(pid, 0);
|
|
40
|
+
return false;
|
|
41
|
+
} catch {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function readEndpoint(file) {
|
|
46
|
+
if (!fs.existsSync(file)) return null;
|
|
47
|
+
try {
|
|
48
|
+
const parsed = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
49
|
+
if (typeof parsed?.port !== "number" || typeof parsed?.token !== "string") return null;
|
|
50
|
+
if (isStale(parsed.pid)) return null;
|
|
51
|
+
return { port: parsed.port, token: parsed.token };
|
|
52
|
+
} catch {
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
function findEndpoint(payload) {
|
|
57
|
+
for (const key of [payload.session_id, payload.conversation_id]) {
|
|
58
|
+
if (typeof key !== "string" || key.length === 0) continue;
|
|
59
|
+
const found = readEndpoint(path.join(cursorApprovalServer.approvalRegistryDir(), `${key}.json`));
|
|
60
|
+
if (found) return found;
|
|
61
|
+
}
|
|
62
|
+
const candidates = [];
|
|
63
|
+
if (typeof payload.cwd === "string") candidates.push(payload.cwd);
|
|
64
|
+
if (Array.isArray(payload.workspace_roots)) {
|
|
65
|
+
for (const root of payload.workspace_roots) {
|
|
66
|
+
if (typeof root === "string") candidates.push(root);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (process.env.CURSOR_PROJECT_DIR) candidates.push(process.env.CURSOR_PROJECT_DIR);
|
|
70
|
+
candidates.push(process.cwd());
|
|
71
|
+
for (const dir of candidates) {
|
|
72
|
+
const found = readEndpoint(path.join(dir, ".cursor", cursorApprovalServer.APPROVAL_ENDPOINT_FILE));
|
|
73
|
+
if (found) return found;
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
async function runCursorApprovalHook() {
|
|
78
|
+
const raw = await readStdin();
|
|
79
|
+
let payload = {};
|
|
80
|
+
try {
|
|
81
|
+
payload = JSON.parse(raw);
|
|
82
|
+
} catch {
|
|
83
|
+
}
|
|
84
|
+
const endpoint = findEndpoint(payload);
|
|
85
|
+
if (!endpoint) {
|
|
86
|
+
emit("allow");
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
const response = await fetch(`http://127.0.0.1:${endpoint.port}/approve`, {
|
|
91
|
+
method: "POST",
|
|
92
|
+
headers: { "content-type": "application/json" },
|
|
93
|
+
body: JSON.stringify({
|
|
94
|
+
token: endpoint.token,
|
|
95
|
+
tool_name: typeof payload.tool_name === "string" ? payload.tool_name : void 0,
|
|
96
|
+
tool_input: payload.tool_input,
|
|
97
|
+
tool_use_id: typeof payload.tool_use_id === "string" ? payload.tool_use_id : void 0
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
if (!response.ok) {
|
|
101
|
+
emit("deny", "Happy could not reach the approval bridge.");
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const result = await response.json();
|
|
105
|
+
if (result.approved === true) {
|
|
106
|
+
emit("allow");
|
|
107
|
+
} else {
|
|
108
|
+
emit("deny", "Denied from Happy.");
|
|
109
|
+
}
|
|
110
|
+
} catch (error) {
|
|
111
|
+
emit("deny", `Happy approval unavailable: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
exports.runCursorApprovalHook = runCursorApprovalHook;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { a as approvalRegistryDir, A as APPROVAL_ENDPOINT_FILE } from './cursorApprovalServer-Ba1yOUCA.mjs';
|
|
4
|
+
import 'node:http';
|
|
5
|
+
import 'node:crypto';
|
|
6
|
+
import 'node:fs/promises';
|
|
7
|
+
import 'node:os';
|
|
8
|
+
import './persistence-DbLMvLvk.mjs';
|
|
9
|
+
import 'zod';
|
|
10
|
+
import 'tweetnacl';
|
|
11
|
+
import 'chalk';
|
|
12
|
+
import 'fs';
|
|
13
|
+
|
|
14
|
+
function readStdin() {
|
|
15
|
+
return new Promise((resolve) => {
|
|
16
|
+
let data = "";
|
|
17
|
+
process.stdin.setEncoding("utf8");
|
|
18
|
+
process.stdin.on("data", (chunk) => {
|
|
19
|
+
data += chunk;
|
|
20
|
+
});
|
|
21
|
+
process.stdin.on("end", () => resolve(data));
|
|
22
|
+
process.stdin.on("error", () => resolve(data));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function emit(permission, userMessage) {
|
|
26
|
+
const payload = { permission };
|
|
27
|
+
if (userMessage) {
|
|
28
|
+
payload.user_message = userMessage;
|
|
29
|
+
payload.agent_message = userMessage;
|
|
30
|
+
}
|
|
31
|
+
process.stdout.write(`${JSON.stringify(payload)}
|
|
32
|
+
`);
|
|
33
|
+
}
|
|
34
|
+
function isStale(pid) {
|
|
35
|
+
if (typeof pid !== "number") return false;
|
|
36
|
+
try {
|
|
37
|
+
process.kill(pid, 0);
|
|
38
|
+
return false;
|
|
39
|
+
} catch {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function readEndpoint(file) {
|
|
44
|
+
if (!existsSync(file)) return null;
|
|
45
|
+
try {
|
|
46
|
+
const parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
47
|
+
if (typeof parsed?.port !== "number" || typeof parsed?.token !== "string") return null;
|
|
48
|
+
if (isStale(parsed.pid)) return null;
|
|
49
|
+
return { port: parsed.port, token: parsed.token };
|
|
50
|
+
} catch {
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
function findEndpoint(payload) {
|
|
55
|
+
for (const key of [payload.session_id, payload.conversation_id]) {
|
|
56
|
+
if (typeof key !== "string" || key.length === 0) continue;
|
|
57
|
+
const found = readEndpoint(join(approvalRegistryDir(), `${key}.json`));
|
|
58
|
+
if (found) return found;
|
|
59
|
+
}
|
|
60
|
+
const candidates = [];
|
|
61
|
+
if (typeof payload.cwd === "string") candidates.push(payload.cwd);
|
|
62
|
+
if (Array.isArray(payload.workspace_roots)) {
|
|
63
|
+
for (const root of payload.workspace_roots) {
|
|
64
|
+
if (typeof root === "string") candidates.push(root);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (process.env.CURSOR_PROJECT_DIR) candidates.push(process.env.CURSOR_PROJECT_DIR);
|
|
68
|
+
candidates.push(process.cwd());
|
|
69
|
+
for (const dir of candidates) {
|
|
70
|
+
const found = readEndpoint(join(dir, ".cursor", APPROVAL_ENDPOINT_FILE));
|
|
71
|
+
if (found) return found;
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
async function runCursorApprovalHook() {
|
|
76
|
+
const raw = await readStdin();
|
|
77
|
+
let payload = {};
|
|
78
|
+
try {
|
|
79
|
+
payload = JSON.parse(raw);
|
|
80
|
+
} catch {
|
|
81
|
+
}
|
|
82
|
+
const endpoint = findEndpoint(payload);
|
|
83
|
+
if (!endpoint) {
|
|
84
|
+
emit("allow");
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
const response = await fetch(`http://127.0.0.1:${endpoint.port}/approve`, {
|
|
89
|
+
method: "POST",
|
|
90
|
+
headers: { "content-type": "application/json" },
|
|
91
|
+
body: JSON.stringify({
|
|
92
|
+
token: endpoint.token,
|
|
93
|
+
tool_name: typeof payload.tool_name === "string" ? payload.tool_name : void 0,
|
|
94
|
+
tool_input: payload.tool_input,
|
|
95
|
+
tool_use_id: typeof payload.tool_use_id === "string" ? payload.tool_use_id : void 0
|
|
96
|
+
})
|
|
97
|
+
});
|
|
98
|
+
if (!response.ok) {
|
|
99
|
+
emit("deny", "Happy could not reach the approval bridge.");
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const result = await response.json();
|
|
103
|
+
if (result.approved === true) {
|
|
104
|
+
emit("allow");
|
|
105
|
+
} else {
|
|
106
|
+
emit("deny", "Denied from Happy.");
|
|
107
|
+
}
|
|
108
|
+
} catch (error) {
|
|
109
|
+
emit("deny", `Happy approval unavailable: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export { runCursorApprovalHook };
|