@zhigang1992/happy-cli 0.12.3 → 0.12.5
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/{index-y8CVImEp.cjs → index-B8KwpPnt.cjs} +212 -35
- package/dist/{index-DNeoLdzx.mjs → index-BfGA--2C.mjs} +198 -21
- package/dist/index.cjs +6 -6
- package/dist/index.mjs +6 -6
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +118 -4
- package/dist/lib.d.mts +118 -4
- package/dist/lib.mjs +1 -1
- package/dist/{list-D_NjiLPx.mjs → list-B0EZS1nk.mjs} +1 -1
- package/dist/{list-DiamEbqL.cjs → list-BmyKI4UO.cjs} +1 -1
- package/dist/{prompt-CJh1Mo2A.mjs → prompt-COmkBtjd.mjs} +1 -1
- package/dist/{prompt-Cu47wZlI.cjs → prompt-SOUeW7vB.cjs} +1 -1
- package/dist/{runCodex-DErgypij.cjs → runCodex-CLxMptoC.cjs} +19 -3
- package/dist/{runCodex-B5ZlUUec.mjs → runCodex-Cxhf8ktE.mjs} +19 -3
- package/dist/{types-CllU28mx.cjs → types-0ILrOpLt.cjs} +140 -7
- package/dist/{types-D4_aCy-H.mjs → types-BmcSXhbq.mjs} +139 -6
- package/package.json +1 -1
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
var chalk = require('chalk');
|
|
4
4
|
var os = require('node:os');
|
|
5
5
|
var node_crypto = require('node:crypto');
|
|
6
|
-
var types = require('./types-
|
|
6
|
+
var types = require('./types-0ILrOpLt.cjs');
|
|
7
7
|
var node_child_process = require('node:child_process');
|
|
8
8
|
var node_path = require('node:path');
|
|
9
9
|
var node_readline = require('node:readline');
|
|
10
10
|
var fs = require('node:fs');
|
|
11
|
+
var child_process = require('child_process');
|
|
12
|
+
var util = require('util');
|
|
13
|
+
var fs$1 = require('fs');
|
|
14
|
+
var path = require('path');
|
|
11
15
|
var promises = require('node:fs/promises');
|
|
12
|
-
var fs$
|
|
16
|
+
var fs$2 = require('fs/promises');
|
|
13
17
|
var ink = require('ink');
|
|
14
18
|
var React = require('react');
|
|
15
19
|
var node_url = require('node:url');
|
|
@@ -18,10 +22,7 @@ require('node:events');
|
|
|
18
22
|
require('socket.io-client');
|
|
19
23
|
var tweetnacl = require('tweetnacl');
|
|
20
24
|
require('expo-server-sdk');
|
|
21
|
-
var path = require('path');
|
|
22
25
|
var crypto = require('crypto');
|
|
23
|
-
var child_process = require('child_process');
|
|
24
|
-
var fs$2 = require('fs');
|
|
25
26
|
var psList = require('ps-list');
|
|
26
27
|
var spawn = require('cross-spawn');
|
|
27
28
|
var os$1 = require('os');
|
|
@@ -36,7 +37,6 @@ var node_http = require('node:http');
|
|
|
36
37
|
var streamableHttp_js = require('@modelcontextprotocol/sdk/server/streamableHttp.js');
|
|
37
38
|
var hex = require('@stablelib/hex');
|
|
38
39
|
var http = require('http');
|
|
39
|
-
var util = require('util');
|
|
40
40
|
|
|
41
41
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
42
42
|
function _interopNamespaceDefault(e) {
|
|
@@ -241,6 +241,99 @@ const systemPrompt = (() => {
|
|
|
241
241
|
}
|
|
242
242
|
})();
|
|
243
243
|
|
|
244
|
+
const execAsync$1 = util.promisify(child_process.exec);
|
|
245
|
+
let direnvAvailable = null;
|
|
246
|
+
async function isDirenvAvailable() {
|
|
247
|
+
if (direnvAvailable !== null) {
|
|
248
|
+
return direnvAvailable;
|
|
249
|
+
}
|
|
250
|
+
try {
|
|
251
|
+
await execAsync$1("direnv version", { timeout: 5e3 });
|
|
252
|
+
direnvAvailable = true;
|
|
253
|
+
types.logger.debug("[direnv] direnv is available");
|
|
254
|
+
} catch {
|
|
255
|
+
direnvAvailable = false;
|
|
256
|
+
types.logger.debug("[direnv] direnv is not available");
|
|
257
|
+
}
|
|
258
|
+
return direnvAvailable;
|
|
259
|
+
}
|
|
260
|
+
function findEnvrcDirectory(startDir) {
|
|
261
|
+
let dir = startDir;
|
|
262
|
+
const root = "/";
|
|
263
|
+
while (dir !== root) {
|
|
264
|
+
const envrcPath = path.join(dir, ".envrc");
|
|
265
|
+
if (fs$1.existsSync(envrcPath)) {
|
|
266
|
+
types.logger.debug(`[direnv] Found .envrc at: ${envrcPath}`);
|
|
267
|
+
return dir;
|
|
268
|
+
}
|
|
269
|
+
const parent = path.dirname(dir);
|
|
270
|
+
if (parent === dir) {
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
dir = parent;
|
|
274
|
+
}
|
|
275
|
+
types.logger.debug(`[direnv] No .envrc found in directory tree for: ${startDir}`);
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
async function loadDirenvEnvironment(cwd) {
|
|
279
|
+
if (!await isDirenvAvailable()) {
|
|
280
|
+
return {};
|
|
281
|
+
}
|
|
282
|
+
const envrcDir = findEnvrcDirectory(cwd);
|
|
283
|
+
if (!envrcDir) {
|
|
284
|
+
return {};
|
|
285
|
+
}
|
|
286
|
+
try {
|
|
287
|
+
types.logger.debug(`[direnv] Loading environment for: ${cwd}`);
|
|
288
|
+
const { stdout, stderr } = await execAsync$1("direnv export json", {
|
|
289
|
+
cwd,
|
|
290
|
+
timeout: 1e4,
|
|
291
|
+
// 10 second timeout
|
|
292
|
+
env: {
|
|
293
|
+
...process.env,
|
|
294
|
+
// Ensure direnv doesn't prompt for allowance interactively
|
|
295
|
+
DIRENV_LOG_FORMAT: ""
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
if (stderr) {
|
|
299
|
+
types.logger.debug(`[direnv] stderr: ${stderr}`);
|
|
300
|
+
}
|
|
301
|
+
const trimmed = stdout.trim();
|
|
302
|
+
if (!trimmed) {
|
|
303
|
+
types.logger.debug("[direnv] No environment changes from direnv");
|
|
304
|
+
return {};
|
|
305
|
+
}
|
|
306
|
+
const direnvVars = JSON.parse(trimmed);
|
|
307
|
+
const varCount = Object.keys(direnvVars).length;
|
|
308
|
+
types.logger.debug(`[direnv] Loaded ${varCount} environment variables`);
|
|
309
|
+
return direnvVars;
|
|
310
|
+
} catch (error) {
|
|
311
|
+
if (error instanceof Error) {
|
|
312
|
+
types.logger.debug(`[direnv] Failed to load environment: ${error.message}`);
|
|
313
|
+
if (error.message.includes("is blocked")) {
|
|
314
|
+
types.logger.debug('[direnv] Hint: Run "direnv allow" in the project directory to allow the .envrc');
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return {};
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
async function loadAndMergeEnvironment(cwd, existingEnv = process.env, overrideEnv = {}) {
|
|
321
|
+
const direnvVars = await loadDirenvEnvironment(cwd);
|
|
322
|
+
const merged = {};
|
|
323
|
+
for (const [key, value] of Object.entries(existingEnv)) {
|
|
324
|
+
if (value !== void 0) {
|
|
325
|
+
merged[key] = value;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
for (const [key, value] of Object.entries(direnvVars)) {
|
|
329
|
+
merged[key] = value;
|
|
330
|
+
}
|
|
331
|
+
for (const [key, value] of Object.entries(overrideEnv)) {
|
|
332
|
+
merged[key] = value;
|
|
333
|
+
}
|
|
334
|
+
return merged;
|
|
335
|
+
}
|
|
336
|
+
|
|
244
337
|
const claudeCliPath = node_path.resolve(node_path.join(types.projectPath(), "scripts", "claude_local_launcher.cjs"));
|
|
245
338
|
async function claudeLocal(opts) {
|
|
246
339
|
const projectDir = getProjectPath(opts.path);
|
|
@@ -282,6 +375,15 @@ async function claudeLocal(opts) {
|
|
|
282
375
|
}
|
|
283
376
|
};
|
|
284
377
|
try {
|
|
378
|
+
const direnvVars = await loadDirenvEnvironment(opts.path);
|
|
379
|
+
if (Object.keys(direnvVars).length > 0) {
|
|
380
|
+
types.logger.debug(`[ClaudeLocal] Loaded ${Object.keys(direnvVars).length} direnv environment variables`);
|
|
381
|
+
}
|
|
382
|
+
const env = {
|
|
383
|
+
...process.env,
|
|
384
|
+
...direnvVars,
|
|
385
|
+
...opts.claudeEnvVars
|
|
386
|
+
};
|
|
285
387
|
process.stdin.pause();
|
|
286
388
|
await new Promise((r, reject) => {
|
|
287
389
|
const args = [];
|
|
@@ -301,10 +403,6 @@ async function claudeLocal(opts) {
|
|
|
301
403
|
if (!claudeCliPath || !fs.existsSync(claudeCliPath)) {
|
|
302
404
|
throw new Error("Claude local launcher not found. Please ensure HAPPY_PROJECT_ROOT is set correctly for development.");
|
|
303
405
|
}
|
|
304
|
-
const env = {
|
|
305
|
-
...process.env,
|
|
306
|
-
...opts.claudeEnvVars
|
|
307
|
-
};
|
|
308
406
|
const child = node_child_process.spawn("node", [claudeCliPath, ...args], {
|
|
309
407
|
stdio: ["inherit", "inherit", "inherit", "pipe"],
|
|
310
408
|
signal: opts.abort,
|
|
@@ -485,7 +583,7 @@ function startFileWatcher(file, onFileChange) {
|
|
|
485
583
|
while (true) {
|
|
486
584
|
try {
|
|
487
585
|
types.logger.debug(`[FILE_WATCHER] Starting watcher for ${file}`);
|
|
488
|
-
const watcher = fs$
|
|
586
|
+
const watcher = fs$2.watch(file, { persistent: true, signal: abortController.signal });
|
|
489
587
|
for await (const event of watcher) {
|
|
490
588
|
if (abortController.signal.aborted) {
|
|
491
589
|
return;
|
|
@@ -984,7 +1082,7 @@ class AbortError extends Error {
|
|
|
984
1082
|
}
|
|
985
1083
|
}
|
|
986
1084
|
|
|
987
|
-
const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-
|
|
1085
|
+
const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-B8KwpPnt.cjs', document.baseURI).href)));
|
|
988
1086
|
const __dirname$1 = node_path.join(__filename$1, "..");
|
|
989
1087
|
function getDefaultClaudeCodePath() {
|
|
990
1088
|
return node_path.join(__dirname$1, "..", "..", "..", "node_modules", "@anthropic-ai", "claude-code", "cli.js");
|
|
@@ -1511,7 +1609,7 @@ async function awaitFileExist(file, timeout = 1e4) {
|
|
|
1511
1609
|
const startTime = Date.now();
|
|
1512
1610
|
while (Date.now() - startTime < timeout) {
|
|
1513
1611
|
try {
|
|
1514
|
-
await fs$
|
|
1612
|
+
await fs$2.access(file);
|
|
1515
1613
|
return true;
|
|
1516
1614
|
} catch (e) {
|
|
1517
1615
|
await types.delay(1e3);
|
|
@@ -1545,6 +1643,13 @@ async function claudeRemote(opts) {
|
|
|
1545
1643
|
}
|
|
1546
1644
|
}
|
|
1547
1645
|
}
|
|
1646
|
+
const direnvVars = await loadDirenvEnvironment(opts.path);
|
|
1647
|
+
if (Object.keys(direnvVars).length > 0) {
|
|
1648
|
+
types.logger.debug(`[claudeRemote] Loaded ${Object.keys(direnvVars).length} direnv environment variables`);
|
|
1649
|
+
}
|
|
1650
|
+
Object.entries(direnvVars).forEach(([key, value]) => {
|
|
1651
|
+
process.env[key] = value;
|
|
1652
|
+
});
|
|
1548
1653
|
if (opts.claudeEnvVars) {
|
|
1549
1654
|
Object.entries(opts.claudeEnvVars).forEach(([key, value]) => {
|
|
1550
1655
|
process.env[key] = value;
|
|
@@ -1651,12 +1756,32 @@ Echo message: ${echoMessage}` : "");
|
|
|
1651
1756
|
}
|
|
1652
1757
|
}
|
|
1653
1758
|
};
|
|
1759
|
+
async function buildMessageContent(text, imageRefs) {
|
|
1760
|
+
if (!imageRefs || imageRefs.length === 0 || !opts.resolveImageRefs) {
|
|
1761
|
+
return text;
|
|
1762
|
+
}
|
|
1763
|
+
types.logger.debug(`[claudeRemote] Resolving ${imageRefs.length} image references`);
|
|
1764
|
+
const resolvedImages = await opts.resolveImageRefs(imageRefs);
|
|
1765
|
+
types.logger.debug(`[claudeRemote] Resolved ${resolvedImages.length} images`);
|
|
1766
|
+
if (resolvedImages.length === 0) {
|
|
1767
|
+
return text;
|
|
1768
|
+
}
|
|
1769
|
+
const content = [];
|
|
1770
|
+
for (const img of resolvedImages) {
|
|
1771
|
+
content.push(img);
|
|
1772
|
+
}
|
|
1773
|
+
if (text) {
|
|
1774
|
+
content.push({ type: "text", text });
|
|
1775
|
+
}
|
|
1776
|
+
return content;
|
|
1777
|
+
}
|
|
1654
1778
|
let messages = new PushableAsyncIterable();
|
|
1779
|
+
const initialContent = await buildMessageContent(initial.message, initial.mode.imageRefs);
|
|
1655
1780
|
messages.push({
|
|
1656
1781
|
type: "user",
|
|
1657
1782
|
message: {
|
|
1658
1783
|
role: "user",
|
|
1659
|
-
content:
|
|
1784
|
+
content: initialContent
|
|
1660
1785
|
}
|
|
1661
1786
|
});
|
|
1662
1787
|
const response = query({
|
|
@@ -1697,7 +1822,8 @@ Echo message: ${echoMessage}` : "");
|
|
|
1697
1822
|
return;
|
|
1698
1823
|
}
|
|
1699
1824
|
mode = next.mode;
|
|
1700
|
-
|
|
1825
|
+
const nextContent = await buildMessageContent(next.message, next.mode.imageRefs);
|
|
1826
|
+
messages.push({ type: "user", message: { role: "user", content: nextContent } });
|
|
1701
1827
|
}
|
|
1702
1828
|
if (message.type === "user") {
|
|
1703
1829
|
const msg = message;
|
|
@@ -2803,6 +2929,18 @@ async function claudeRemoteLauncher(session) {
|
|
|
2803
2929
|
isAborted: (toolCallId) => {
|
|
2804
2930
|
return permissionHandler.isAborted(toolCallId);
|
|
2805
2931
|
},
|
|
2932
|
+
resolveImageRefs: async (imageRefs) => {
|
|
2933
|
+
const resolved = [];
|
|
2934
|
+
for (const imageRef of imageRefs) {
|
|
2935
|
+
const image = await session.client.resolveImageRef(imageRef);
|
|
2936
|
+
if (image) {
|
|
2937
|
+
resolved.push(image);
|
|
2938
|
+
} else {
|
|
2939
|
+
types.logger.debug(`[remote]: Failed to resolve image ref: ${imageRef.blobId}`);
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
return resolved;
|
|
2943
|
+
},
|
|
2806
2944
|
nextMessage: async () => {
|
|
2807
2945
|
if (pending) {
|
|
2808
2946
|
let p = pending;
|
|
@@ -2908,6 +3046,16 @@ async function claudeRemoteLauncher(session) {
|
|
|
2908
3046
|
|
|
2909
3047
|
async function loop(opts) {
|
|
2910
3048
|
const logPath = types.logger.logFilePath;
|
|
3049
|
+
const sessionEnv = await loadAndMergeEnvironment(
|
|
3050
|
+
opts.path,
|
|
3051
|
+
process.env,
|
|
3052
|
+
opts.claudeEnvVars ?? {}
|
|
3053
|
+
);
|
|
3054
|
+
types.logger.debug(`[loop] Loaded session environment with ${Object.keys(sessionEnv).length} variables`);
|
|
3055
|
+
opts.session.rpcHandlerManager.setSessionContext({
|
|
3056
|
+
path: opts.path,
|
|
3057
|
+
env: sessionEnv
|
|
3058
|
+
});
|
|
2911
3059
|
let session = new Session({
|
|
2912
3060
|
api: opts.api,
|
|
2913
3061
|
client: opts.session,
|
|
@@ -3504,7 +3652,7 @@ async function isDaemonRunningCurrentlyInstalledHappyVersion() {
|
|
|
3504
3652
|
}
|
|
3505
3653
|
try {
|
|
3506
3654
|
const packageJsonPath = path.join(types.projectPath(), "package.json");
|
|
3507
|
-
const packageJson = JSON.parse(fs$
|
|
3655
|
+
const packageJson = JSON.parse(fs$1.readFileSync(packageJsonPath, "utf-8"));
|
|
3508
3656
|
const currentCliVersion = packageJson.version;
|
|
3509
3657
|
types.logger.debug(`[DAEMON CONTROL] Current CLI version: ${currentCliVersion}, Daemon started with version: ${state.startedWithCliVersion}`);
|
|
3510
3658
|
return currentCliVersion === state.startedWithCliVersion;
|
|
@@ -4451,7 +4599,7 @@ async function startDaemon() {
|
|
|
4451
4599
|
const { directory, sessionId, machineId: machineId2, approvedNewDirectoryCreation = true } = options;
|
|
4452
4600
|
let directoryCreated = false;
|
|
4453
4601
|
try {
|
|
4454
|
-
await fs$
|
|
4602
|
+
await fs$2.access(directory);
|
|
4455
4603
|
types.logger.debug(`[DAEMON RUN] Directory exists: ${directory}`);
|
|
4456
4604
|
} catch (error) {
|
|
4457
4605
|
types.logger.debug(`[DAEMON RUN] Directory doesn't exist, creating: ${directory}`);
|
|
@@ -4463,7 +4611,7 @@ async function startDaemon() {
|
|
|
4463
4611
|
};
|
|
4464
4612
|
}
|
|
4465
4613
|
try {
|
|
4466
|
-
await fs$
|
|
4614
|
+
await fs$2.mkdir(directory, { recursive: true });
|
|
4467
4615
|
types.logger.debug(`[DAEMON RUN] Successfully created directory: ${directory}`);
|
|
4468
4616
|
directoryCreated = true;
|
|
4469
4617
|
} catch (mkdirError) {
|
|
@@ -4491,7 +4639,7 @@ async function startDaemon() {
|
|
|
4491
4639
|
if (options.token) {
|
|
4492
4640
|
if (options.agent === "codex") {
|
|
4493
4641
|
const codexHomeDir = tmp__namespace.dirSync();
|
|
4494
|
-
fs$
|
|
4642
|
+
fs$2.writeFile(path.join(codexHomeDir.name, "auth.json"), options.token);
|
|
4495
4643
|
extraEnv = {
|
|
4496
4644
|
CODEX_HOME: codexHomeDir.name
|
|
4497
4645
|
};
|
|
@@ -4668,7 +4816,7 @@ async function startDaemon() {
|
|
|
4668
4816
|
pidToTrackedSession.delete(pid);
|
|
4669
4817
|
}
|
|
4670
4818
|
}
|
|
4671
|
-
const projectVersion = JSON.parse(fs$
|
|
4819
|
+
const projectVersion = JSON.parse(fs$1.readFileSync(path.join(types.projectPath(), "package.json"), "utf-8")).version;
|
|
4672
4820
|
if (projectVersion !== types.configuration.currentCliVersion) {
|
|
4673
4821
|
types.logger.debug("[DAEMON RUN] Daemon is outdated, triggering self-restart with latest version, clearing heartbeat interval");
|
|
4674
4822
|
clearInterval(restartOnStaleVersionAndHeartbeat);
|
|
@@ -4831,6 +4979,27 @@ function registerKillSessionHandler(rpcHandlerManager, killThisHappy) {
|
|
|
4831
4979
|
});
|
|
4832
4980
|
}
|
|
4833
4981
|
|
|
4982
|
+
function extractTextFromContent(content) {
|
|
4983
|
+
if (!Array.isArray(content)) {
|
|
4984
|
+
if (content.type === "text") {
|
|
4985
|
+
return content.text;
|
|
4986
|
+
}
|
|
4987
|
+
return "";
|
|
4988
|
+
}
|
|
4989
|
+
const textParts = [];
|
|
4990
|
+
for (const block of content) {
|
|
4991
|
+
if (block.type === "text") {
|
|
4992
|
+
textParts.push(block.text);
|
|
4993
|
+
}
|
|
4994
|
+
}
|
|
4995
|
+
return textParts.join("\n");
|
|
4996
|
+
}
|
|
4997
|
+
function extractImageRefs(content) {
|
|
4998
|
+
if (!Array.isArray(content)) {
|
|
4999
|
+
return [];
|
|
5000
|
+
}
|
|
5001
|
+
return content.filter((block) => block.type === "image_ref");
|
|
5002
|
+
}
|
|
4834
5003
|
async function runClaude(credentials, options = {}) {
|
|
4835
5004
|
const workingDirectory = process.cwd();
|
|
4836
5005
|
const sessionTag = node_crypto.randomUUID();
|
|
@@ -4997,7 +5166,12 @@ async function runClaude(credentials, options = {}) {
|
|
|
4997
5166
|
} else {
|
|
4998
5167
|
types.logger.debug(`[loop] User message received with no disallowed tools override, using current: ${currentDisallowedTools ? currentDisallowedTools.join(", ") : "none"}`);
|
|
4999
5168
|
}
|
|
5000
|
-
const
|
|
5169
|
+
const textContent = extractTextFromContent(message.content);
|
|
5170
|
+
const imageRefs = extractImageRefs(message.content);
|
|
5171
|
+
if (imageRefs.length > 0) {
|
|
5172
|
+
types.logger.debug(`[loop] User message contains ${imageRefs.length} image(s)`);
|
|
5173
|
+
}
|
|
5174
|
+
const specialCommand = parseSpecialCommand(textContent);
|
|
5001
5175
|
if (specialCommand.type === "compact") {
|
|
5002
5176
|
types.logger.debug("[start] Detected /compact command");
|
|
5003
5177
|
const enhancedMode2 = {
|
|
@@ -5007,9 +5181,10 @@ async function runClaude(credentials, options = {}) {
|
|
|
5007
5181
|
customSystemPrompt: messageCustomSystemPrompt,
|
|
5008
5182
|
appendSystemPrompt: messageAppendSystemPrompt,
|
|
5009
5183
|
allowedTools: messageAllowedTools,
|
|
5010
|
-
disallowedTools: messageDisallowedTools
|
|
5184
|
+
disallowedTools: messageDisallowedTools,
|
|
5185
|
+
imageRefs: imageRefs.length > 0 ? imageRefs : void 0
|
|
5011
5186
|
};
|
|
5012
|
-
messageQueue.pushIsolateAndClear(specialCommand.originalMessage ||
|
|
5187
|
+
messageQueue.pushIsolateAndClear(specialCommand.originalMessage || textContent, enhancedMode2);
|
|
5013
5188
|
types.logger.debugLargeJson("[start] /compact command pushed to queue:", message);
|
|
5014
5189
|
return;
|
|
5015
5190
|
}
|
|
@@ -5022,9 +5197,10 @@ async function runClaude(credentials, options = {}) {
|
|
|
5022
5197
|
customSystemPrompt: messageCustomSystemPrompt,
|
|
5023
5198
|
appendSystemPrompt: messageAppendSystemPrompt,
|
|
5024
5199
|
allowedTools: messageAllowedTools,
|
|
5025
|
-
disallowedTools: messageDisallowedTools
|
|
5200
|
+
disallowedTools: messageDisallowedTools,
|
|
5201
|
+
imageRefs: imageRefs.length > 0 ? imageRefs : void 0
|
|
5026
5202
|
};
|
|
5027
|
-
messageQueue.pushIsolateAndClear(specialCommand.originalMessage ||
|
|
5203
|
+
messageQueue.pushIsolateAndClear(specialCommand.originalMessage || textContent, enhancedMode2);
|
|
5028
5204
|
types.logger.debugLargeJson("[start] /compact command pushed to queue:", message);
|
|
5029
5205
|
return;
|
|
5030
5206
|
}
|
|
@@ -5035,9 +5211,10 @@ async function runClaude(credentials, options = {}) {
|
|
|
5035
5211
|
customSystemPrompt: messageCustomSystemPrompt,
|
|
5036
5212
|
appendSystemPrompt: messageAppendSystemPrompt,
|
|
5037
5213
|
allowedTools: messageAllowedTools,
|
|
5038
|
-
disallowedTools: messageDisallowedTools
|
|
5214
|
+
disallowedTools: messageDisallowedTools,
|
|
5215
|
+
imageRefs: imageRefs.length > 0 ? imageRefs : void 0
|
|
5039
5216
|
};
|
|
5040
|
-
messageQueue.push(
|
|
5217
|
+
messageQueue.push(textContent, enhancedMode);
|
|
5041
5218
|
types.logger.debugLargeJson("User message pushed to queue:", message);
|
|
5042
5219
|
});
|
|
5043
5220
|
const cleanup = async () => {
|
|
@@ -5118,7 +5295,7 @@ const PLIST_LABEL$1 = "com.happy-cli.daemon";
|
|
|
5118
5295
|
const PLIST_FILE$1 = `/Library/LaunchDaemons/${PLIST_LABEL$1}.plist`;
|
|
5119
5296
|
async function install$1() {
|
|
5120
5297
|
try {
|
|
5121
|
-
if (fs$
|
|
5298
|
+
if (fs$1.existsSync(PLIST_FILE$1)) {
|
|
5122
5299
|
types.logger.info("Daemon plist already exists. Uninstalling first...");
|
|
5123
5300
|
child_process.execSync(`launchctl unload ${PLIST_FILE$1}`, { stdio: "inherit" });
|
|
5124
5301
|
}
|
|
@@ -5162,8 +5339,8 @@ async function install$1() {
|
|
|
5162
5339
|
</dict>
|
|
5163
5340
|
</plist>
|
|
5164
5341
|
`);
|
|
5165
|
-
fs$
|
|
5166
|
-
fs$
|
|
5342
|
+
fs$1.writeFileSync(PLIST_FILE$1, plistContent);
|
|
5343
|
+
fs$1.chmodSync(PLIST_FILE$1, 420);
|
|
5167
5344
|
types.logger.info(`Created daemon plist at ${PLIST_FILE$1}`);
|
|
5168
5345
|
child_process.execSync(`launchctl load ${PLIST_FILE$1}`, { stdio: "inherit" });
|
|
5169
5346
|
types.logger.info("Daemon installed and started successfully");
|
|
@@ -5189,7 +5366,7 @@ const PLIST_LABEL = "com.happy-cli.daemon";
|
|
|
5189
5366
|
const PLIST_FILE = `/Library/LaunchDaemons/${PLIST_LABEL}.plist`;
|
|
5190
5367
|
async function uninstall$1() {
|
|
5191
5368
|
try {
|
|
5192
|
-
if (!fs$
|
|
5369
|
+
if (!fs$1.existsSync(PLIST_FILE)) {
|
|
5193
5370
|
types.logger.info("Daemon plist not found. Nothing to uninstall.");
|
|
5194
5371
|
return;
|
|
5195
5372
|
}
|
|
@@ -5199,7 +5376,7 @@ async function uninstall$1() {
|
|
|
5199
5376
|
} catch (error) {
|
|
5200
5377
|
types.logger.info("Failed to unload daemon (it might not be running)");
|
|
5201
5378
|
}
|
|
5202
|
-
fs$
|
|
5379
|
+
fs$1.unlinkSync(PLIST_FILE);
|
|
5203
5380
|
types.logger.info(`Removed daemon plist from ${PLIST_FILE}`);
|
|
5204
5381
|
types.logger.info("Daemon uninstalled successfully");
|
|
5205
5382
|
} catch (error) {
|
|
@@ -6216,7 +6393,7 @@ async function handleConnectVendor(vendor, displayName) {
|
|
|
6216
6393
|
return;
|
|
6217
6394
|
} else if (subcommand === "codex") {
|
|
6218
6395
|
try {
|
|
6219
|
-
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-
|
|
6396
|
+
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-CLxMptoC.cjs'); });
|
|
6220
6397
|
let startedBy = void 0;
|
|
6221
6398
|
for (let i = 1; i < args.length; i++) {
|
|
6222
6399
|
if (args[i] === "--started-by") {
|
|
@@ -6261,7 +6438,7 @@ async function handleConnectVendor(vendor, displayName) {
|
|
|
6261
6438
|
} else if (subcommand === "list") {
|
|
6262
6439
|
try {
|
|
6263
6440
|
const { credentials } = await authAndSetupMachineIfNeeded();
|
|
6264
|
-
const { listSessions } = await Promise.resolve().then(function () { return require('./list-
|
|
6441
|
+
const { listSessions } = await Promise.resolve().then(function () { return require('./list-BmyKI4UO.cjs'); });
|
|
6265
6442
|
let sessionId;
|
|
6266
6443
|
let titleFilter;
|
|
6267
6444
|
let recentMsgs;
|
|
@@ -6363,7 +6540,7 @@ Examples:
|
|
|
6363
6540
|
process.exit(1);
|
|
6364
6541
|
}
|
|
6365
6542
|
const { credentials } = await authAndSetupMachineIfNeeded();
|
|
6366
|
-
const { promptSession } = await Promise.resolve().then(function () { return require('./prompt-
|
|
6543
|
+
const { promptSession } = await Promise.resolve().then(function () { return require('./prompt-SOUeW7vB.cjs'); });
|
|
6367
6544
|
await promptSession(credentials, sessionId, promptText, timeoutMinutes ?? void 0);
|
|
6368
6545
|
} catch (error) {
|
|
6369
6546
|
console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
|