@zhigang1992/happy-cli 0.12.15 → 0.13.1
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-BXhnIvhV.cjs → index-BRJ9n6X5.cjs} +22 -67
- package/dist/{index-C1S8W6hS.mjs → index-CGAeCOSR.mjs} +21 -66
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +2 -0
- package/dist/lib.d.mts +2 -0
- package/dist/lib.mjs +1 -1
- package/dist/{list-DnyoGVs0.cjs → list-CtFTdtWH.cjs} +1 -1
- package/dist/{list-CXZgsrb3.mjs → list-DHjjInfx.mjs} +1 -1
- package/dist/{prompt-CvpPWx4v.mjs → prompt-BdW97nWA.mjs} +1 -1
- package/dist/{prompt-1J3xTRvg.cjs → prompt-DMPO33Q2.cjs} +1 -1
- package/dist/{runCodex-CDA2a_3g.cjs → runCodex-Djz88-rF.cjs} +2 -2
- package/dist/{runCodex-CWaOl3u2.mjs → runCodex-c_cSo6EI.mjs} +2 -2
- package/dist/{types-CYn1BLoj.cjs → types-CPlDgP66.cjs} +4 -4
- package/dist/{types-Do0vU1JP.mjs → types-DQi1uyzQ.mjs} +3 -3
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
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-CPlDgP66.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');
|
|
@@ -1184,7 +1184,7 @@ class AbortError extends Error {
|
|
|
1184
1184
|
}
|
|
1185
1185
|
}
|
|
1186
1186
|
|
|
1187
|
-
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-
|
|
1187
|
+
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-BRJ9n6X5.cjs', document.baseURI).href)));
|
|
1188
1188
|
const __dirname$1 = node_path.join(__filename$1, "..");
|
|
1189
1189
|
function getGlobalClaudeVersion() {
|
|
1190
1190
|
try {
|
|
@@ -2162,9 +2162,6 @@ Echo message: ${echoMessage}` : "");
|
|
|
2162
2162
|
}
|
|
2163
2163
|
}
|
|
2164
2164
|
|
|
2165
|
-
const PLAN_FAKE_REJECT = `User approved plan, but you need to be restarted. STOP IMMEDIATELY TO SWITCH FROM PLAN MODE. DO NOT REPLY TO THIS MESSAGE.`;
|
|
2166
|
-
const PLAN_FAKE_RESTART = `PlEaZe Continue with plan.`;
|
|
2167
|
-
|
|
2168
2165
|
function deepEqual(a, b) {
|
|
2169
2166
|
if (a === b) return true;
|
|
2170
2167
|
if (a == null || b == null) return false;
|
|
@@ -2275,15 +2272,10 @@ class PermissionHandler {
|
|
|
2275
2272
|
if (pending.toolName === "exit_plan_mode" || pending.toolName === "ExitPlanMode") {
|
|
2276
2273
|
types.logger.debug("Plan mode result received", response);
|
|
2277
2274
|
if (response.approved) {
|
|
2278
|
-
types.logger.debug("Plan approved -
|
|
2279
|
-
|
|
2280
|
-
this.session.queue.unshift(PLAN_FAKE_RESTART, { permissionMode: response.mode });
|
|
2281
|
-
} else {
|
|
2282
|
-
this.session.queue.unshift(PLAN_FAKE_RESTART, { permissionMode: "default" });
|
|
2283
|
-
}
|
|
2284
|
-
pending.resolve({ behavior: "deny", message: PLAN_FAKE_REJECT });
|
|
2275
|
+
types.logger.debug("Plan approved - continuing normally");
|
|
2276
|
+
pending.resolve({ behavior: "allow", updatedInput: pending.input || {} });
|
|
2285
2277
|
} else {
|
|
2286
|
-
pending.resolve({ behavior: "deny", message: response.reason || "Plan rejected" });
|
|
2278
|
+
pending.resolve({ behavior: "deny", message: response.reason || "Plan rejected by user. Ask the user what changes they would like to make to the plan." });
|
|
2287
2279
|
}
|
|
2288
2280
|
} else if (pending.toolName === "AskUserQuestion") {
|
|
2289
2281
|
if (response.approved) {
|
|
@@ -2320,7 +2312,8 @@ class PermissionHandler {
|
|
|
2320
2312
|
return { behavior: "allow", updatedInput: input };
|
|
2321
2313
|
}
|
|
2322
2314
|
const descriptor = getToolDescriptor(toolName);
|
|
2323
|
-
|
|
2315
|
+
const requiresUserInteraction = toolName === "AskUserQuestion" || toolName === "ExitPlanMode" || toolName === "exit_plan_mode";
|
|
2316
|
+
if (!requiresUserInteraction) {
|
|
2324
2317
|
if (this.permissionMode === "bypassPermissions") {
|
|
2325
2318
|
return { behavior: "allow", updatedInput: input };
|
|
2326
2319
|
}
|
|
@@ -2463,10 +2456,6 @@ class PermissionHandler {
|
|
|
2463
2456
|
if (this.responses.get(toolCallId)?.approved === false) {
|
|
2464
2457
|
return true;
|
|
2465
2458
|
}
|
|
2466
|
-
const toolCall = this.toolCalls.find((tc) => tc.id === toolCallId);
|
|
2467
|
-
if (toolCall && (toolCall.name === "exit_plan_mode" || toolCall.name === "ExitPlanMode")) {
|
|
2468
|
-
return true;
|
|
2469
|
-
}
|
|
2470
2459
|
return false;
|
|
2471
2460
|
}
|
|
2472
2461
|
/**
|
|
@@ -3093,22 +3082,10 @@ async function claudeRemoteLauncher(session) {
|
|
|
3093
3082
|
cwd: session.path,
|
|
3094
3083
|
version: process.env.npm_package_version
|
|
3095
3084
|
}, permissionHandler.getResponses());
|
|
3096
|
-
let planModeToolCalls = /* @__PURE__ */ new Set();
|
|
3097
3085
|
let ongoingToolCalls = /* @__PURE__ */ new Map();
|
|
3098
3086
|
function onMessage(message) {
|
|
3099
3087
|
formatClaudeMessageForInk(message, messageBuffer);
|
|
3100
3088
|
permissionHandler.onMessage(message);
|
|
3101
|
-
if (message.type === "assistant") {
|
|
3102
|
-
let umessage = message;
|
|
3103
|
-
if (umessage.message.content && Array.isArray(umessage.message.content)) {
|
|
3104
|
-
for (let c of umessage.message.content) {
|
|
3105
|
-
if (c.type === "tool_use" && (c.name === "exit_plan_mode" || c.name === "ExitPlanMode")) {
|
|
3106
|
-
types.logger.debug("[remote]: detected plan mode tool call " + c.id);
|
|
3107
|
-
planModeToolCalls.add(c.id);
|
|
3108
|
-
}
|
|
3109
|
-
}
|
|
3110
|
-
}
|
|
3111
|
-
}
|
|
3112
3089
|
if (message.type === "assistant") {
|
|
3113
3090
|
let umessage = message;
|
|
3114
3091
|
if (umessage.message.content && Array.isArray(umessage.message.content)) {
|
|
@@ -3131,36 +3108,7 @@ async function claudeRemoteLauncher(session) {
|
|
|
3131
3108
|
}
|
|
3132
3109
|
}
|
|
3133
3110
|
}
|
|
3134
|
-
|
|
3135
|
-
if (message.type === "user") {
|
|
3136
|
-
let umessage = message;
|
|
3137
|
-
if (umessage.message.content && Array.isArray(umessage.message.content)) {
|
|
3138
|
-
msg = {
|
|
3139
|
-
...umessage,
|
|
3140
|
-
message: {
|
|
3141
|
-
...umessage.message,
|
|
3142
|
-
content: umessage.message.content.map((c) => {
|
|
3143
|
-
if (c.type === "tool_result" && c.tool_use_id && planModeToolCalls.has(c.tool_use_id)) {
|
|
3144
|
-
if (c.content === PLAN_FAKE_REJECT) {
|
|
3145
|
-
types.logger.debug("[remote]: hack plan mode exit");
|
|
3146
|
-
types.logger.debugLargeJson("[remote]: hack plan mode exit", c);
|
|
3147
|
-
return {
|
|
3148
|
-
...c,
|
|
3149
|
-
is_error: false,
|
|
3150
|
-
content: "Plan approved",
|
|
3151
|
-
mode: c.mode
|
|
3152
|
-
};
|
|
3153
|
-
} else {
|
|
3154
|
-
return c;
|
|
3155
|
-
}
|
|
3156
|
-
}
|
|
3157
|
-
return c;
|
|
3158
|
-
})
|
|
3159
|
-
}
|
|
3160
|
-
};
|
|
3161
|
-
}
|
|
3162
|
-
}
|
|
3163
|
-
const logMessage = sdkToLogConverter.convert(msg);
|
|
3111
|
+
const logMessage = sdkToLogConverter.convert(message);
|
|
3164
3112
|
if (logMessage) {
|
|
3165
3113
|
if (logMessage.type === "user" && logMessage.message?.content) {
|
|
3166
3114
|
const content = Array.isArray(logMessage.message.content) ? logMessage.message.content : [];
|
|
@@ -5126,20 +5074,24 @@ async function startDaemon() {
|
|
|
5126
5074
|
}
|
|
5127
5075
|
}
|
|
5128
5076
|
try {
|
|
5129
|
-
let
|
|
5077
|
+
let authEnv = {};
|
|
5130
5078
|
if (options.token) {
|
|
5131
5079
|
if (options.agent === "codex") {
|
|
5132
5080
|
const codexHomeDir = tmp__namespace.dirSync();
|
|
5133
5081
|
fs$2.writeFile(path.join(codexHomeDir.name, "auth.json"), options.token);
|
|
5134
|
-
|
|
5082
|
+
authEnv = {
|
|
5135
5083
|
CODEX_HOME: codexHomeDir.name
|
|
5136
5084
|
};
|
|
5137
5085
|
} else {
|
|
5138
|
-
|
|
5086
|
+
authEnv = {
|
|
5139
5087
|
CLAUDE_CODE_OAUTH_TOKEN: options.token
|
|
5140
5088
|
};
|
|
5141
5089
|
}
|
|
5142
5090
|
}
|
|
5091
|
+
const userEnv = options.environmentVariables || {};
|
|
5092
|
+
if (Object.keys(userEnv).length > 0) {
|
|
5093
|
+
types.logger.debug(`[DAEMON RUN] Using custom environment variables: ${Object.keys(userEnv).join(", ")}`);
|
|
5094
|
+
}
|
|
5143
5095
|
const args = [
|
|
5144
5096
|
options.agent === "claude" ? "claude" : "codex",
|
|
5145
5097
|
"--happy-starting-mode",
|
|
@@ -5157,7 +5109,10 @@ async function startDaemon() {
|
|
|
5157
5109
|
// Capture stdout/stderr for debugging
|
|
5158
5110
|
env: {
|
|
5159
5111
|
...process.env,
|
|
5160
|
-
...
|
|
5112
|
+
...userEnv,
|
|
5113
|
+
// User-provided env vars override process.env
|
|
5114
|
+
...authEnv
|
|
5115
|
+
// Auth tokens have highest priority (never overridden)
|
|
5161
5116
|
}
|
|
5162
5117
|
});
|
|
5163
5118
|
if (process.env.DEBUG) {
|
|
@@ -7030,7 +6985,7 @@ async function handleConnectVendor(vendor, displayName) {
|
|
|
7030
6985
|
return;
|
|
7031
6986
|
} else if (subcommand === "codex") {
|
|
7032
6987
|
try {
|
|
7033
|
-
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-
|
|
6988
|
+
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-Djz88-rF.cjs'); });
|
|
7034
6989
|
let startedBy = void 0;
|
|
7035
6990
|
for (let i = 1; i < args.length; i++) {
|
|
7036
6991
|
if (args[i] === "--started-by") {
|
|
@@ -7075,7 +7030,7 @@ async function handleConnectVendor(vendor, displayName) {
|
|
|
7075
7030
|
} else if (subcommand === "list") {
|
|
7076
7031
|
try {
|
|
7077
7032
|
const { credentials } = await authAndSetupMachineIfNeeded();
|
|
7078
|
-
const { listSessions } = await Promise.resolve().then(function () { return require('./list-
|
|
7033
|
+
const { listSessions } = await Promise.resolve().then(function () { return require('./list-CtFTdtWH.cjs'); });
|
|
7079
7034
|
let sessionId;
|
|
7080
7035
|
let titleFilter;
|
|
7081
7036
|
let recentMsgs;
|
|
@@ -7177,7 +7132,7 @@ Examples:
|
|
|
7177
7132
|
process.exit(1);
|
|
7178
7133
|
}
|
|
7179
7134
|
const { credentials } = await authAndSetupMachineIfNeeded();
|
|
7180
|
-
const { promptSession } = await Promise.resolve().then(function () { return require('./prompt-
|
|
7135
|
+
const { promptSession } = await Promise.resolve().then(function () { return require('./prompt-DMPO33Q2.cjs'); });
|
|
7181
7136
|
await promptSession(credentials, sessionId, promptText, timeoutMinutes ?? void 0);
|
|
7182
7137
|
} catch (error) {
|
|
7183
7138
|
console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import os$1, { homedir } from 'node:os';
|
|
3
3
|
import { randomUUID, randomBytes, createHmac } from 'node:crypto';
|
|
4
|
-
import { l as logger, p as projectPath, j as backoff, k as delay, R as RawJSONLinesSchema, m as AsyncLock, c as configuration, n as readDaemonState, o as clearDaemonState, i as packageJson, r as readSettings, q as readCredentials, g as encodeBase64, u as updateSettings, s as encodeBase64Url, d as decodeBase64, w as writeCredentialsLegacy, t as writeCredentialsDataKey, v as acquireDaemonLock, x as writeDaemonState, A as ApiClient, y as releaseDaemonLock, z as authChallenge, B as clearCredentials, C as clearMachineId, D as getLatestDaemonLog } from './types-
|
|
4
|
+
import { l as logger, p as projectPath, j as backoff, k as delay, R as RawJSONLinesSchema, m as AsyncLock, c as configuration, n as readDaemonState, o as clearDaemonState, i as packageJson, r as readSettings, q as readCredentials, g as encodeBase64, u as updateSettings, s as encodeBase64Url, d as decodeBase64, w as writeCredentialsLegacy, t as writeCredentialsDataKey, v as acquireDaemonLock, x as writeDaemonState, A as ApiClient, y as releaseDaemonLock, z as authChallenge, B as clearCredentials, C as clearMachineId, D as getLatestDaemonLog } from './types-DQi1uyzQ.mjs';
|
|
5
5
|
import { spawn, execSync, exec as exec$1, execFileSync } from 'node:child_process';
|
|
6
6
|
import { resolve, join, extname, basename as basename$1 } from 'node:path';
|
|
7
7
|
import { createInterface } from 'node:readline';
|
|
@@ -2139,9 +2139,6 @@ Echo message: ${echoMessage}` : "");
|
|
|
2139
2139
|
}
|
|
2140
2140
|
}
|
|
2141
2141
|
|
|
2142
|
-
const PLAN_FAKE_REJECT = `User approved plan, but you need to be restarted. STOP IMMEDIATELY TO SWITCH FROM PLAN MODE. DO NOT REPLY TO THIS MESSAGE.`;
|
|
2143
|
-
const PLAN_FAKE_RESTART = `PlEaZe Continue with plan.`;
|
|
2144
|
-
|
|
2145
2142
|
function deepEqual(a, b) {
|
|
2146
2143
|
if (a === b) return true;
|
|
2147
2144
|
if (a == null || b == null) return false;
|
|
@@ -2252,15 +2249,10 @@ class PermissionHandler {
|
|
|
2252
2249
|
if (pending.toolName === "exit_plan_mode" || pending.toolName === "ExitPlanMode") {
|
|
2253
2250
|
logger.debug("Plan mode result received", response);
|
|
2254
2251
|
if (response.approved) {
|
|
2255
|
-
logger.debug("Plan approved -
|
|
2256
|
-
|
|
2257
|
-
this.session.queue.unshift(PLAN_FAKE_RESTART, { permissionMode: response.mode });
|
|
2258
|
-
} else {
|
|
2259
|
-
this.session.queue.unshift(PLAN_FAKE_RESTART, { permissionMode: "default" });
|
|
2260
|
-
}
|
|
2261
|
-
pending.resolve({ behavior: "deny", message: PLAN_FAKE_REJECT });
|
|
2252
|
+
logger.debug("Plan approved - continuing normally");
|
|
2253
|
+
pending.resolve({ behavior: "allow", updatedInput: pending.input || {} });
|
|
2262
2254
|
} else {
|
|
2263
|
-
pending.resolve({ behavior: "deny", message: response.reason || "Plan rejected" });
|
|
2255
|
+
pending.resolve({ behavior: "deny", message: response.reason || "Plan rejected by user. Ask the user what changes they would like to make to the plan." });
|
|
2264
2256
|
}
|
|
2265
2257
|
} else if (pending.toolName === "AskUserQuestion") {
|
|
2266
2258
|
if (response.approved) {
|
|
@@ -2297,7 +2289,8 @@ class PermissionHandler {
|
|
|
2297
2289
|
return { behavior: "allow", updatedInput: input };
|
|
2298
2290
|
}
|
|
2299
2291
|
const descriptor = getToolDescriptor(toolName);
|
|
2300
|
-
|
|
2292
|
+
const requiresUserInteraction = toolName === "AskUserQuestion" || toolName === "ExitPlanMode" || toolName === "exit_plan_mode";
|
|
2293
|
+
if (!requiresUserInteraction) {
|
|
2301
2294
|
if (this.permissionMode === "bypassPermissions") {
|
|
2302
2295
|
return { behavior: "allow", updatedInput: input };
|
|
2303
2296
|
}
|
|
@@ -2440,10 +2433,6 @@ class PermissionHandler {
|
|
|
2440
2433
|
if (this.responses.get(toolCallId)?.approved === false) {
|
|
2441
2434
|
return true;
|
|
2442
2435
|
}
|
|
2443
|
-
const toolCall = this.toolCalls.find((tc) => tc.id === toolCallId);
|
|
2444
|
-
if (toolCall && (toolCall.name === "exit_plan_mode" || toolCall.name === "ExitPlanMode")) {
|
|
2445
|
-
return true;
|
|
2446
|
-
}
|
|
2447
2436
|
return false;
|
|
2448
2437
|
}
|
|
2449
2438
|
/**
|
|
@@ -3070,22 +3059,10 @@ async function claudeRemoteLauncher(session) {
|
|
|
3070
3059
|
cwd: session.path,
|
|
3071
3060
|
version: process.env.npm_package_version
|
|
3072
3061
|
}, permissionHandler.getResponses());
|
|
3073
|
-
let planModeToolCalls = /* @__PURE__ */ new Set();
|
|
3074
3062
|
let ongoingToolCalls = /* @__PURE__ */ new Map();
|
|
3075
3063
|
function onMessage(message) {
|
|
3076
3064
|
formatClaudeMessageForInk(message, messageBuffer);
|
|
3077
3065
|
permissionHandler.onMessage(message);
|
|
3078
|
-
if (message.type === "assistant") {
|
|
3079
|
-
let umessage = message;
|
|
3080
|
-
if (umessage.message.content && Array.isArray(umessage.message.content)) {
|
|
3081
|
-
for (let c of umessage.message.content) {
|
|
3082
|
-
if (c.type === "tool_use" && (c.name === "exit_plan_mode" || c.name === "ExitPlanMode")) {
|
|
3083
|
-
logger.debug("[remote]: detected plan mode tool call " + c.id);
|
|
3084
|
-
planModeToolCalls.add(c.id);
|
|
3085
|
-
}
|
|
3086
|
-
}
|
|
3087
|
-
}
|
|
3088
|
-
}
|
|
3089
3066
|
if (message.type === "assistant") {
|
|
3090
3067
|
let umessage = message;
|
|
3091
3068
|
if (umessage.message.content && Array.isArray(umessage.message.content)) {
|
|
@@ -3108,36 +3085,7 @@ async function claudeRemoteLauncher(session) {
|
|
|
3108
3085
|
}
|
|
3109
3086
|
}
|
|
3110
3087
|
}
|
|
3111
|
-
|
|
3112
|
-
if (message.type === "user") {
|
|
3113
|
-
let umessage = message;
|
|
3114
|
-
if (umessage.message.content && Array.isArray(umessage.message.content)) {
|
|
3115
|
-
msg = {
|
|
3116
|
-
...umessage,
|
|
3117
|
-
message: {
|
|
3118
|
-
...umessage.message,
|
|
3119
|
-
content: umessage.message.content.map((c) => {
|
|
3120
|
-
if (c.type === "tool_result" && c.tool_use_id && planModeToolCalls.has(c.tool_use_id)) {
|
|
3121
|
-
if (c.content === PLAN_FAKE_REJECT) {
|
|
3122
|
-
logger.debug("[remote]: hack plan mode exit");
|
|
3123
|
-
logger.debugLargeJson("[remote]: hack plan mode exit", c);
|
|
3124
|
-
return {
|
|
3125
|
-
...c,
|
|
3126
|
-
is_error: false,
|
|
3127
|
-
content: "Plan approved",
|
|
3128
|
-
mode: c.mode
|
|
3129
|
-
};
|
|
3130
|
-
} else {
|
|
3131
|
-
return c;
|
|
3132
|
-
}
|
|
3133
|
-
}
|
|
3134
|
-
return c;
|
|
3135
|
-
})
|
|
3136
|
-
}
|
|
3137
|
-
};
|
|
3138
|
-
}
|
|
3139
|
-
}
|
|
3140
|
-
const logMessage = sdkToLogConverter.convert(msg);
|
|
3088
|
+
const logMessage = sdkToLogConverter.convert(message);
|
|
3141
3089
|
if (logMessage) {
|
|
3142
3090
|
if (logMessage.type === "user" && logMessage.message?.content) {
|
|
3143
3091
|
const content = Array.isArray(logMessage.message.content) ? logMessage.message.content : [];
|
|
@@ -5103,20 +5051,24 @@ async function startDaemon() {
|
|
|
5103
5051
|
}
|
|
5104
5052
|
}
|
|
5105
5053
|
try {
|
|
5106
|
-
let
|
|
5054
|
+
let authEnv = {};
|
|
5107
5055
|
if (options.token) {
|
|
5108
5056
|
if (options.agent === "codex") {
|
|
5109
5057
|
const codexHomeDir = tmp.dirSync();
|
|
5110
5058
|
fs.writeFile(join$1(codexHomeDir.name, "auth.json"), options.token);
|
|
5111
|
-
|
|
5059
|
+
authEnv = {
|
|
5112
5060
|
CODEX_HOME: codexHomeDir.name
|
|
5113
5061
|
};
|
|
5114
5062
|
} else {
|
|
5115
|
-
|
|
5063
|
+
authEnv = {
|
|
5116
5064
|
CLAUDE_CODE_OAUTH_TOKEN: options.token
|
|
5117
5065
|
};
|
|
5118
5066
|
}
|
|
5119
5067
|
}
|
|
5068
|
+
const userEnv = options.environmentVariables || {};
|
|
5069
|
+
if (Object.keys(userEnv).length > 0) {
|
|
5070
|
+
logger.debug(`[DAEMON RUN] Using custom environment variables: ${Object.keys(userEnv).join(", ")}`);
|
|
5071
|
+
}
|
|
5120
5072
|
const args = [
|
|
5121
5073
|
options.agent === "claude" ? "claude" : "codex",
|
|
5122
5074
|
"--happy-starting-mode",
|
|
@@ -5134,7 +5086,10 @@ async function startDaemon() {
|
|
|
5134
5086
|
// Capture stdout/stderr for debugging
|
|
5135
5087
|
env: {
|
|
5136
5088
|
...process.env,
|
|
5137
|
-
...
|
|
5089
|
+
...userEnv,
|
|
5090
|
+
// User-provided env vars override process.env
|
|
5091
|
+
...authEnv
|
|
5092
|
+
// Auth tokens have highest priority (never overridden)
|
|
5138
5093
|
}
|
|
5139
5094
|
});
|
|
5140
5095
|
if (process.env.DEBUG) {
|
|
@@ -7007,7 +6962,7 @@ async function handleConnectVendor(vendor, displayName) {
|
|
|
7007
6962
|
return;
|
|
7008
6963
|
} else if (subcommand === "codex") {
|
|
7009
6964
|
try {
|
|
7010
|
-
const { runCodex } = await import('./runCodex-
|
|
6965
|
+
const { runCodex } = await import('./runCodex-c_cSo6EI.mjs');
|
|
7011
6966
|
let startedBy = void 0;
|
|
7012
6967
|
for (let i = 1; i < args.length; i++) {
|
|
7013
6968
|
if (args[i] === "--started-by") {
|
|
@@ -7052,7 +7007,7 @@ async function handleConnectVendor(vendor, displayName) {
|
|
|
7052
7007
|
} else if (subcommand === "list") {
|
|
7053
7008
|
try {
|
|
7054
7009
|
const { credentials } = await authAndSetupMachineIfNeeded();
|
|
7055
|
-
const { listSessions } = await import('./list-
|
|
7010
|
+
const { listSessions } = await import('./list-DHjjInfx.mjs');
|
|
7056
7011
|
let sessionId;
|
|
7057
7012
|
let titleFilter;
|
|
7058
7013
|
let recentMsgs;
|
|
@@ -7154,7 +7109,7 @@ Examples:
|
|
|
7154
7109
|
process.exit(1);
|
|
7155
7110
|
}
|
|
7156
7111
|
const { credentials } = await authAndSetupMachineIfNeeded();
|
|
7157
|
-
const { promptSession } = await import('./prompt-
|
|
7112
|
+
const { promptSession } = await import('./prompt-BdW97nWA.mjs');
|
|
7158
7113
|
await promptSession(credentials, sessionId, promptText, timeoutMinutes ?? void 0);
|
|
7159
7114
|
} catch (error) {
|
|
7160
7115
|
console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
|
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
package/dist/lib.cjs
CHANGED
package/dist/lib.d.cts
CHANGED
|
@@ -768,6 +768,8 @@ interface SpawnSessionOptions {
|
|
|
768
768
|
agent?: 'claude' | 'codex';
|
|
769
769
|
token?: string;
|
|
770
770
|
resumeClaudeSessionId?: string;
|
|
771
|
+
/** Environment variables to pass to the spawned session */
|
|
772
|
+
environmentVariables?: Record<string, string>;
|
|
771
773
|
}
|
|
772
774
|
type SpawnSessionResult = {
|
|
773
775
|
type: 'success';
|
package/dist/lib.d.mts
CHANGED
|
@@ -768,6 +768,8 @@ interface SpawnSessionOptions {
|
|
|
768
768
|
agent?: 'claude' | 'codex';
|
|
769
769
|
token?: string;
|
|
770
770
|
resumeClaudeSessionId?: string;
|
|
771
|
+
/** Environment variables to pass to the spawned session */
|
|
772
|
+
environmentVariables?: Record<string, string>;
|
|
771
773
|
}
|
|
772
774
|
type SpawnSessionResult = {
|
|
773
775
|
type: 'success';
|
package/dist/lib.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ApiClient, a as ApiSessionClient, R as RawJSONLinesSchema, c as configuration, l as logger } from './types-
|
|
1
|
+
export { A as ApiClient, a as ApiSessionClient, R as RawJSONLinesSchema, c as configuration, l as logger } from './types-DQi1uyzQ.mjs';
|
|
2
2
|
import 'axios';
|
|
3
3
|
import 'chalk';
|
|
4
4
|
import 'fs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as configuration, l as logger, d as decodeBase64, b as decrypt, f as formatTimeAgo, e as libsodiumDecryptFromPublicKey } from './types-
|
|
1
|
+
import { c as configuration, l as logger, d as decodeBase64, b as decrypt, f as formatTimeAgo, e as libsodiumDecryptFromPublicKey } from './types-DQi1uyzQ.mjs';
|
|
2
2
|
import axios from 'axios';
|
|
3
3
|
import { existsSync, readdirSync, statSync, readFileSync } from 'fs';
|
|
4
4
|
import { join } from 'path';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as configuration, b as decrypt, d as decodeBase64, l as logger, g as encodeBase64, h as encrypt } from './types-
|
|
1
|
+
import { c as configuration, b as decrypt, d as decodeBase64, l as logger, g as encodeBase64, h as encrypt } from './types-DQi1uyzQ.mjs';
|
|
2
2
|
import axios from 'axios';
|
|
3
3
|
import { io } from 'socket.io-client';
|
|
4
4
|
import 'chalk';
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var ink = require('ink');
|
|
4
4
|
var React = require('react');
|
|
5
|
-
var types = require('./types-
|
|
5
|
+
var types = require('./types-CPlDgP66.cjs');
|
|
6
6
|
var index_js = require('@modelcontextprotocol/sdk/client/index.js');
|
|
7
7
|
var stdio_js = require('@modelcontextprotocol/sdk/client/stdio.js');
|
|
8
8
|
var z = require('zod');
|
|
9
9
|
var types_js = require('@modelcontextprotocol/sdk/types.js');
|
|
10
10
|
var child_process = require('child_process');
|
|
11
11
|
var node_crypto = require('node:crypto');
|
|
12
|
-
var index = require('./index-
|
|
12
|
+
var index = require('./index-BRJ9n6X5.cjs');
|
|
13
13
|
var os = require('node:os');
|
|
14
14
|
var node_path = require('node:path');
|
|
15
15
|
var fs = require('node:fs');
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
2
2
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
3
|
-
import { l as logger, A as ApiClient, r as readSettings, p as projectPath, c as configuration, i as packageJson } from './types-
|
|
3
|
+
import { l as logger, A as ApiClient, r as readSettings, p as projectPath, c as configuration, i as packageJson } from './types-DQi1uyzQ.mjs';
|
|
4
4
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
5
5
|
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import { ElicitRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
8
8
|
import { execSync } from 'child_process';
|
|
9
9
|
import { randomUUID } from 'node:crypto';
|
|
10
|
-
import { i as initialMachineMetadata, n as notifyDaemonSessionStarted, M as MessageQueue2, h as hashObject, r as registerKillSessionHandler, a as MessageBuffer, s as startHappyServer, t as trimIdent, b as stopCaffeinate } from './index-
|
|
10
|
+
import { i as initialMachineMetadata, n as notifyDaemonSessionStarted, M as MessageQueue2, h as hashObject, r as registerKillSessionHandler, a as MessageBuffer, s as startHappyServer, t as trimIdent, b as stopCaffeinate } from './index-CGAeCOSR.mjs';
|
|
11
11
|
import os from 'node:os';
|
|
12
12
|
import { resolve, join } from 'node:path';
|
|
13
13
|
import fs from 'node:fs';
|
|
@@ -41,7 +41,7 @@ function _interopNamespaceDefault(e) {
|
|
|
41
41
|
var z__namespace = /*#__PURE__*/_interopNamespaceDefault(z);
|
|
42
42
|
|
|
43
43
|
var name = "@zhigang1992/happy-cli";
|
|
44
|
-
var version = "0.
|
|
44
|
+
var version = "0.13.1";
|
|
45
45
|
var description = "Mobile and Web client for Claude Code and Codex";
|
|
46
46
|
var author = "Kirill Dubovitskiy";
|
|
47
47
|
var license = "MIT";
|
|
@@ -1150,7 +1150,7 @@ class RpcHandlerManager {
|
|
|
1150
1150
|
}
|
|
1151
1151
|
}
|
|
1152
1152
|
|
|
1153
|
-
const __dirname$1 = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('types-
|
|
1153
|
+
const __dirname$1 = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('types-CPlDgP66.cjs', document.baseURI).href))));
|
|
1154
1154
|
function projectPath() {
|
|
1155
1155
|
const path$1 = path.resolve(__dirname$1, "..");
|
|
1156
1156
|
return path$1;
|
|
@@ -1914,12 +1914,12 @@ class ApiMachineClient {
|
|
|
1914
1914
|
requestShutdown
|
|
1915
1915
|
}) {
|
|
1916
1916
|
this.rpcHandlerManager.registerHandler("spawn-happy-session", async (params) => {
|
|
1917
|
-
const { directory, sessionId, machineId, approvedNewDirectoryCreation, agent, token, resumeClaudeSessionId } = params || {};
|
|
1917
|
+
const { directory, sessionId, machineId, approvedNewDirectoryCreation, agent, token, resumeClaudeSessionId, environmentVariables } = params || {};
|
|
1918
1918
|
logger.debug(`[API MACHINE] Spawning session with params: ${JSON.stringify(params)}`);
|
|
1919
1919
|
if (!directory) {
|
|
1920
1920
|
throw new Error("Directory is required");
|
|
1921
1921
|
}
|
|
1922
|
-
const result = await spawnSession({ directory, sessionId, machineId, approvedNewDirectoryCreation, agent, token, resumeClaudeSessionId });
|
|
1922
|
+
const result = await spawnSession({ directory, sessionId, machineId, approvedNewDirectoryCreation, agent, token, resumeClaudeSessionId, environmentVariables });
|
|
1923
1923
|
switch (result.type) {
|
|
1924
1924
|
case "success":
|
|
1925
1925
|
logger.debug(`[API MACHINE] Spawned session ${result.sessionId}`);
|
|
@@ -20,7 +20,7 @@ import { fileURLToPath } from 'url';
|
|
|
20
20
|
import { Expo } from 'expo-server-sdk';
|
|
21
21
|
|
|
22
22
|
var name = "@zhigang1992/happy-cli";
|
|
23
|
-
var version = "0.
|
|
23
|
+
var version = "0.13.1";
|
|
24
24
|
var description = "Mobile and Web client for Claude Code and Codex";
|
|
25
25
|
var author = "Kirill Dubovitskiy";
|
|
26
26
|
var license = "MIT";
|
|
@@ -1893,12 +1893,12 @@ class ApiMachineClient {
|
|
|
1893
1893
|
requestShutdown
|
|
1894
1894
|
}) {
|
|
1895
1895
|
this.rpcHandlerManager.registerHandler("spawn-happy-session", async (params) => {
|
|
1896
|
-
const { directory, sessionId, machineId, approvedNewDirectoryCreation, agent, token, resumeClaudeSessionId } = params || {};
|
|
1896
|
+
const { directory, sessionId, machineId, approvedNewDirectoryCreation, agent, token, resumeClaudeSessionId, environmentVariables } = params || {};
|
|
1897
1897
|
logger.debug(`[API MACHINE] Spawning session with params: ${JSON.stringify(params)}`);
|
|
1898
1898
|
if (!directory) {
|
|
1899
1899
|
throw new Error("Directory is required");
|
|
1900
1900
|
}
|
|
1901
|
-
const result = await spawnSession({ directory, sessionId, machineId, approvedNewDirectoryCreation, agent, token, resumeClaudeSessionId });
|
|
1901
|
+
const result = await spawnSession({ directory, sessionId, machineId, approvedNewDirectoryCreation, agent, token, resumeClaudeSessionId, environmentVariables });
|
|
1902
1902
|
switch (result.type) {
|
|
1903
1903
|
case "success":
|
|
1904
1904
|
logger.debug(`[API MACHINE] Spawned session ${result.sessionId}`);
|