zenflo 0.11.5 → 0.11.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +419 -37
- package/dist/codex/zenfloMcpStdioBridge.cjs +2 -2
- package/dist/codex/zenfloMcpStdioBridge.mjs +2 -2
- package/dist/{index-6-qKdQ7W.cjs → index-HBSmEvnF.cjs} +83 -46
- package/dist/{index-DuOY65WC.mjs → index-yJG0qz0r.mjs} +82 -45
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +28 -13
- package/dist/lib.d.mts +28 -13
- package/dist/lib.mjs +1 -1
- package/dist/{runCodex-hZGg21lA.mjs → runCodex-Bl0T0A2Z.mjs} +23 -6
- package/dist/{runCodex-qe9_J04U.cjs → runCodex-cXLrsovg.cjs} +23 -6
- package/dist/{types-ROQJQZrv.mjs → types-DJhJK2jD.mjs} +39 -30
- package/dist/{types-BowvGBcM.cjs → types-Dvhor4zW.cjs} +40 -31
- package/package.json +1 -1
- package/scripts/claude_local_launcher.cjs +262 -5
- package/scripts/extension_wrapper.sh +13 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import os$1, { homedir } from 'node:os';
|
|
3
3
|
import { randomUUID, randomBytes } from 'node:crypto';
|
|
4
|
-
import { l as logger, p as projectPath, d as backoff, e as delay, R as RawJSONLinesSchema, f as AsyncLock, c as configuration, g as readDaemonState, h as clearDaemonState, b as packageJson, r as readSettings, i as readCredentials, j as encodeBase64, u as updateSettings, k as encodeBase64Url, m as decodeBase64, w as writeCredentialsLegacy, n as writeCredentialsDataKey, o as acquireDaemonLock, q as writeDaemonState, A as ApiClient, s as releaseDaemonLock, t as clearCredentials, v as clearMachineId, x as getLatestDaemonLog } from './types-
|
|
4
|
+
import { l as logger, p as projectPath, d as backoff, e as delay, R as RawJSONLinesSchema, f as AsyncLock, c as configuration, g as readDaemonState, h as clearDaemonState, b as packageJson, r as readSettings, i as readCredentials, j as encodeBase64, u as updateSettings, k as encodeBase64Url, m as decodeBase64, w as writeCredentialsLegacy, n as writeCredentialsDataKey, o as acquireDaemonLock, q as writeDaemonState, A as ApiClient, s as releaseDaemonLock, t as clearCredentials, v as clearMachineId, x as getLatestDaemonLog } from './types-DJhJK2jD.mjs';
|
|
5
5
|
import { spawn, execSync, execFileSync } from 'node:child_process';
|
|
6
6
|
import { resolve, join } from 'node:path';
|
|
7
7
|
import { createInterface } from 'node:readline';
|
|
@@ -194,18 +194,29 @@ function shouldIncludeCoAuthoredBy() {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
const BASE_SYSTEM_PROMPT = (() => trimIdent(`
|
|
197
|
-
ALWAYS when you start a new chat - you must call a tool "
|
|
197
|
+
ALWAYS when you start a new chat - you must call a tool "mcp__zenflo__change_title" to set a chat title. When you think chat title is not relevant anymore - call the tool again to change it. When chat name is too generic and you have a change to make it more specific - call the tool again to change it. This title is needed to easily find the chat in the future. Help human.
|
|
198
|
+
|
|
199
|
+
\u26A0\uFE0F CRITICAL: Use Zen Mode MCP, NOT TodoWrite tool
|
|
200
|
+
|
|
201
|
+
At the START of EVERY session, you MUST:
|
|
202
|
+
1. Call mcp__zen_mode__list_tasks to see existing tasks
|
|
203
|
+
2. Use mcp__zen_mode__create_task to create new tasks for the session
|
|
204
|
+
3. Use mcp__zen_mode__update_task to update status as you work
|
|
205
|
+
4. NEVER use TodoWrite tool - it doesn't sync across devices
|
|
206
|
+
|
|
207
|
+
Task Priorities: LOW, MEDIUM, HIGH, URGENT
|
|
208
|
+
Task Status: TODO, IN_PROGRESS, DONE, CANCELLED
|
|
198
209
|
`))();
|
|
199
210
|
const CO_AUTHORED_CREDITS = (() => trimIdent(`
|
|
200
|
-
When making commit messages, instead of just giving co-credit to Claude, also give credit to
|
|
211
|
+
When making commit messages, instead of just giving co-credit to Claude, also give credit to ZenFlo like so:
|
|
201
212
|
|
|
202
213
|
<main commit message>
|
|
203
214
|
|
|
204
215
|
Generated with [Claude Code](https://claude.ai/code)
|
|
205
|
-
via [
|
|
216
|
+
via [ZenFlo](https://zenflo.app)
|
|
206
217
|
|
|
207
218
|
Co-Authored-By: Claude <noreply@anthropic.com>
|
|
208
|
-
Co-Authored-By:
|
|
219
|
+
Co-Authored-By: ZenFlo <yesreply@zenflo.app>
|
|
209
220
|
`))();
|
|
210
221
|
const systemPrompt = (() => {
|
|
211
222
|
const includeCoAuthored = shouldIncludeCoAuthoredBy();
|
|
@@ -257,7 +268,10 @@ async function claudeLocal(opts) {
|
|
|
257
268
|
}
|
|
258
269
|
};
|
|
259
270
|
try {
|
|
260
|
-
|
|
271
|
+
const isStreamJsonMode = opts.claudeArgs?.includes("--input-format") && opts.claudeArgs?.includes("stream-json");
|
|
272
|
+
if (!isStreamJsonMode) {
|
|
273
|
+
process.stdin.pause();
|
|
274
|
+
}
|
|
261
275
|
await new Promise((r, reject) => {
|
|
262
276
|
const args = [];
|
|
263
277
|
if (startFrom) {
|
|
@@ -274,7 +288,7 @@ async function claudeLocal(opts) {
|
|
|
274
288
|
args.push(...opts.claudeArgs);
|
|
275
289
|
}
|
|
276
290
|
if (!claudeCliPath || !existsSync(claudeCliPath)) {
|
|
277
|
-
throw new Error("Claude local launcher not found. Please ensure
|
|
291
|
+
throw new Error("Claude local launcher not found. Please ensure ZENFLO_PROJECT_ROOT is set correctly for development.");
|
|
278
292
|
}
|
|
279
293
|
const env = {
|
|
280
294
|
...process.env,
|
|
@@ -282,10 +296,16 @@ async function claudeLocal(opts) {
|
|
|
282
296
|
};
|
|
283
297
|
const child = spawn("node", [claudeCliPath, ...args], {
|
|
284
298
|
stdio: ["inherit", "inherit", "inherit", "pipe"],
|
|
285
|
-
signal: opts.abort,
|
|
286
299
|
cwd: opts.path,
|
|
287
300
|
env
|
|
288
301
|
});
|
|
302
|
+
const abortHandler = () => {
|
|
303
|
+
if (!child.killed) {
|
|
304
|
+
logger.debug("[ClaudeLocal] Abort signal received, killing child process");
|
|
305
|
+
child.kill("SIGTERM");
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
opts.abort.addEventListener("abort", abortHandler);
|
|
289
309
|
if (child.stdio[3]) {
|
|
290
310
|
const rl = createInterface({
|
|
291
311
|
input: child.stdio[3],
|
|
@@ -357,7 +377,10 @@ async function claudeLocal(opts) {
|
|
|
357
377
|
});
|
|
358
378
|
} finally {
|
|
359
379
|
watcher.close();
|
|
360
|
-
|
|
380
|
+
const isStreamJsonMode = opts.claudeArgs?.includes("--input-format") && opts.claudeArgs?.includes("stream-json");
|
|
381
|
+
if (!isStreamJsonMode) {
|
|
382
|
+
process.stdin.resume();
|
|
383
|
+
}
|
|
361
384
|
if (stopThinkingTimeout) {
|
|
362
385
|
clearTimeout(stopThinkingTimeout);
|
|
363
386
|
stopThinkingTimeout = null;
|
|
@@ -541,7 +564,7 @@ async function createSessionScanner(opts) {
|
|
|
541
564
|
await sync.invalidateAndAwait();
|
|
542
565
|
sync.stop();
|
|
543
566
|
},
|
|
544
|
-
onNewSession: (sessionId) => {
|
|
567
|
+
onNewSession: async (sessionId) => {
|
|
545
568
|
if (currentSessionId === sessionId) {
|
|
546
569
|
logger.debug(`[SESSION_SCANNER] New session: ${sessionId} is the same as the current session, skipping`);
|
|
547
570
|
return;
|
|
@@ -559,6 +582,19 @@ async function createSessionScanner(opts) {
|
|
|
559
582
|
}
|
|
560
583
|
logger.debug(`[SESSION_SCANNER] New session: ${sessionId}`);
|
|
561
584
|
currentSessionId = sessionId;
|
|
585
|
+
try {
|
|
586
|
+
const existingMessages = await readSessionLog(projectDir, sessionId);
|
|
587
|
+
logger.debug(`[SESSION_SCANNER] Found ${existingMessages.length} existing messages in new session ${sessionId}`);
|
|
588
|
+
for (const message of existingMessages) {
|
|
589
|
+
const key = messageKey(message);
|
|
590
|
+
if (!processedMessageKeys.has(key)) {
|
|
591
|
+
processedMessageKeys.add(key);
|
|
592
|
+
opts.onMessage(message);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
} catch (err) {
|
|
596
|
+
logger.debug(`[SESSION_SCANNER] Error reading existing messages: ${err}`);
|
|
597
|
+
}
|
|
562
598
|
sync.invalidate();
|
|
563
599
|
}
|
|
564
600
|
};
|
|
@@ -572,6 +608,8 @@ function messageKey(message) {
|
|
|
572
608
|
return "summary: " + message.leafUuid + ": " + message.summary;
|
|
573
609
|
} else if (message.type === "system") {
|
|
574
610
|
return message.uuid;
|
|
611
|
+
} else if (message.type === "queue-operation") {
|
|
612
|
+
return "queue-operation: " + message.timestamp + ": " + message.operation;
|
|
575
613
|
} else {
|
|
576
614
|
throw Error();
|
|
577
615
|
}
|
|
@@ -596,7 +634,8 @@ async function readSessionLog(projectDir, sessionId) {
|
|
|
596
634
|
let message = JSON.parse(l);
|
|
597
635
|
let parsed = RawJSONLinesSchema.safeParse(message);
|
|
598
636
|
if (!parsed.success) {
|
|
599
|
-
logger.
|
|
637
|
+
logger.debug(`[SESSION_SCANNER] Failed to parse message - Zod error:`, parsed.error.errors);
|
|
638
|
+
logger.debugLargeJson(`[SESSION_SCANNER] Failed message content:`, message);
|
|
600
639
|
continue;
|
|
601
640
|
}
|
|
602
641
|
messages.push(parsed.data);
|
|
@@ -613,7 +652,7 @@ async function claudeLocalLauncher(session) {
|
|
|
613
652
|
sessionId: session.sessionId,
|
|
614
653
|
workingDirectory: session.path,
|
|
615
654
|
onMessage: (message) => {
|
|
616
|
-
if (message.type !== "summary") {
|
|
655
|
+
if (message.type !== "summary" && message.type !== "queue-operation") {
|
|
617
656
|
session.client.sendClaudeSessionMessage(message);
|
|
618
657
|
}
|
|
619
658
|
}
|
|
@@ -3188,7 +3227,7 @@ function hashObject(obj, options, encoding = "hex") {
|
|
|
3188
3227
|
let caffeinateProcess = null;
|
|
3189
3228
|
function startCaffeinate() {
|
|
3190
3229
|
if (configuration.disableCaffeinate) {
|
|
3191
|
-
logger.debug("[caffeinate] Caffeinate disabled via
|
|
3230
|
+
logger.debug("[caffeinate] Caffeinate disabled via ZENFLO_DISABLE_CAFFEINATE environment variable");
|
|
3192
3231
|
return false;
|
|
3193
3232
|
}
|
|
3194
3233
|
if (process.platform !== "darwin") {
|
|
@@ -3332,7 +3371,7 @@ async function daemonPost(path, body) {
|
|
|
3332
3371
|
};
|
|
3333
3372
|
}
|
|
3334
3373
|
try {
|
|
3335
|
-
const timeout = process.env.
|
|
3374
|
+
const timeout = process.env.ZENFLO_DAEMON_HTTP_TIMEOUT ? parseInt(process.env.ZENFLO_DAEMON_HTTP_TIMEOUT) : 1e4;
|
|
3336
3375
|
const response = await fetch(`http://127.0.0.1:${state.httpPort}${path}`, {
|
|
3337
3376
|
method: "POST",
|
|
3338
3377
|
headers: { "Content-Type": "application/json" },
|
|
@@ -3531,16 +3570,14 @@ function getEnvironmentInfo() {
|
|
|
3531
3570
|
return {
|
|
3532
3571
|
PWD: process.env.PWD,
|
|
3533
3572
|
ZENFLO_HOME_DIR: process.env.ZENFLO_HOME_DIR,
|
|
3534
|
-
HAPPY_HOME_DIR: process.env.HAPPY_HOME_DIR,
|
|
3535
3573
|
ZENFLO_SERVER_URL: process.env.ZENFLO_SERVER_URL,
|
|
3536
|
-
|
|
3537
|
-
HAPPY_PROJECT_ROOT: process.env.HAPPY_PROJECT_ROOT,
|
|
3574
|
+
ZENFLO_PROJECT_ROOT: process.env.ZENFLO_PROJECT_ROOT,
|
|
3538
3575
|
DANGEROUSLY_LOG_TO_SERVER_FOR_AI_AUTO_DEBUGGING: process.env.DANGEROUSLY_LOG_TO_SERVER_FOR_AI_AUTO_DEBUGGING,
|
|
3539
3576
|
NODE_ENV: process.env.NODE_ENV,
|
|
3540
3577
|
DEBUG: process.env.DEBUG,
|
|
3541
3578
|
workingDirectory: process.cwd(),
|
|
3542
3579
|
processArgv: process.argv,
|
|
3543
|
-
happyDir: configuration?.
|
|
3580
|
+
happyDir: configuration?.zenfloHomeDir,
|
|
3544
3581
|
serverUrl: configuration?.serverUrl,
|
|
3545
3582
|
logsDir: configuration?.logsDir,
|
|
3546
3583
|
processPid: process.pid,
|
|
@@ -3589,15 +3626,13 @@ async function runDoctorCommand(filter) {
|
|
|
3589
3626
|
console.log(`CLI Exists: ${existsSync(cliEntrypoint) ? chalk.green("\u2713 Yes") : chalk.red("\u274C No")}`);
|
|
3590
3627
|
console.log("");
|
|
3591
3628
|
console.log(chalk.bold("\u2699\uFE0F Configuration"));
|
|
3592
|
-
console.log(`Happy Home: ${chalk.blue(configuration.
|
|
3629
|
+
console.log(`Happy Home: ${chalk.blue(configuration.zenfloHomeDir)}`);
|
|
3593
3630
|
console.log(`Server URL: ${chalk.blue(configuration.serverUrl)}`);
|
|
3594
3631
|
console.log(`Logs Dir: ${chalk.blue(configuration.logsDir)}`);
|
|
3595
3632
|
console.log(chalk.bold("\n\u{1F30D} Environment Variables"));
|
|
3596
3633
|
const env = getEnvironmentInfo();
|
|
3597
3634
|
console.log(`ZENFLO_HOME_DIR: ${env.ZENFLO_HOME_DIR ? chalk.green(env.ZENFLO_HOME_DIR) : chalk.gray("not set")}`);
|
|
3598
|
-
console.log(`HAPPY_HOME_DIR (legacy): ${env.HAPPY_HOME_DIR ? chalk.yellow(env.HAPPY_HOME_DIR) : chalk.gray("not set")}`);
|
|
3599
3635
|
console.log(`ZENFLO_SERVER_URL: ${env.ZENFLO_SERVER_URL ? chalk.green(env.ZENFLO_SERVER_URL) : chalk.gray("not set")}`);
|
|
3600
|
-
console.log(`HAPPY_SERVER_URL (legacy): ${env.HAPPY_SERVER_URL ? chalk.yellow(env.HAPPY_SERVER_URL) : chalk.gray("not set")}`);
|
|
3601
3636
|
console.log(`DANGEROUSLY_LOG_TO_SERVER: ${env.DANGEROUSLY_LOG_TO_SERVER_FOR_AI_AUTO_DEBUGGING ? chalk.yellow("ENABLED") : chalk.gray("not set")}`);
|
|
3602
3637
|
console.log(`DEBUG: ${env.DEBUG ? chalk.green(env.DEBUG) : chalk.gray("not set")}`);
|
|
3603
3638
|
console.log(`NODE_ENV: ${env.NODE_ENV ? chalk.green(env.NODE_ENV) : chalk.gray("not set")}`);
|
|
@@ -4014,7 +4049,7 @@ function startDaemonControlServer({
|
|
|
4014
4049
|
stopSession,
|
|
4015
4050
|
spawnSession,
|
|
4016
4051
|
requestShutdown,
|
|
4017
|
-
|
|
4052
|
+
onZenfloSessionWebhook
|
|
4018
4053
|
}) {
|
|
4019
4054
|
return new Promise((resolve) => {
|
|
4020
4055
|
const app = fastify({
|
|
@@ -4040,7 +4075,7 @@ function startDaemonControlServer({
|
|
|
4040
4075
|
}, async (request) => {
|
|
4041
4076
|
const { sessionId, metadata } = request.body;
|
|
4042
4077
|
logger.debug(`[CONTROL SERVER] Session started: ${sessionId}`);
|
|
4043
|
-
|
|
4078
|
+
onZenfloSessionWebhook(sessionId, metadata);
|
|
4044
4079
|
return { status: "ok" };
|
|
4045
4080
|
});
|
|
4046
4081
|
typed.post("/list", {
|
|
@@ -4179,10 +4214,10 @@ function startDaemonControlServer({
|
|
|
4179
4214
|
const initialMachineMetadata = {
|
|
4180
4215
|
host: os.hostname(),
|
|
4181
4216
|
platform: os.platform(),
|
|
4182
|
-
|
|
4217
|
+
zenfloCliVersion: packageJson.version,
|
|
4183
4218
|
homeDir: os.homedir(),
|
|
4184
|
-
|
|
4185
|
-
|
|
4219
|
+
zenfloHomeDir: configuration.zenfloHomeDir,
|
|
4220
|
+
zenfloLibDir: projectPath()
|
|
4186
4221
|
};
|
|
4187
4222
|
async function startDaemon() {
|
|
4188
4223
|
let requestShutdown;
|
|
@@ -4249,7 +4284,7 @@ async function startDaemon() {
|
|
|
4249
4284
|
const pidToTrackedSession = /* @__PURE__ */ new Map();
|
|
4250
4285
|
const pidToAwaiter = /* @__PURE__ */ new Map();
|
|
4251
4286
|
const getCurrentChildren = () => Array.from(pidToTrackedSession.values());
|
|
4252
|
-
const
|
|
4287
|
+
const onZenfloSessionWebhook = (sessionId, sessionMetadata) => {
|
|
4253
4288
|
logger.debugLargeJson(`[DAEMON RUN] Session reported`, sessionMetadata);
|
|
4254
4289
|
const pid = sessionMetadata.hostPid;
|
|
4255
4290
|
if (!pid) {
|
|
@@ -4271,7 +4306,7 @@ async function startDaemon() {
|
|
|
4271
4306
|
}
|
|
4272
4307
|
} else if (!existingSession) {
|
|
4273
4308
|
const trackedSession = {
|
|
4274
|
-
startedBy: "
|
|
4309
|
+
startedBy: "zenflo directly - likely by user from terminal",
|
|
4275
4310
|
zenfloSessionId: sessionId,
|
|
4276
4311
|
zenfloSessionMetadataFromLocalWebhook: sessionMetadata,
|
|
4277
4312
|
pid
|
|
@@ -4336,8 +4371,9 @@ async function startDaemon() {
|
|
|
4336
4371
|
}
|
|
4337
4372
|
}
|
|
4338
4373
|
const args = [
|
|
4339
|
-
options.agent
|
|
4340
|
-
|
|
4374
|
+
options.agent || "claude",
|
|
4375
|
+
// Use the agent directly (claude, codex, qwen, gemini)
|
|
4376
|
+
"--zenflo-starting-mode",
|
|
4341
4377
|
"remote",
|
|
4342
4378
|
"--started-by",
|
|
4343
4379
|
"daemon"
|
|
@@ -4452,8 +4488,8 @@ async function startDaemon() {
|
|
|
4452
4488
|
getChildren: getCurrentChildren,
|
|
4453
4489
|
stopSession,
|
|
4454
4490
|
spawnSession,
|
|
4455
|
-
requestShutdown: () => requestShutdown("
|
|
4456
|
-
|
|
4491
|
+
requestShutdown: () => requestShutdown("zenflo-cli"),
|
|
4492
|
+
onZenfloSessionWebhook
|
|
4457
4493
|
});
|
|
4458
4494
|
const fileState = {
|
|
4459
4495
|
pid: process.pid,
|
|
@@ -4481,10 +4517,10 @@ async function startDaemon() {
|
|
|
4481
4517
|
apiMachine.setRPCHandlers({
|
|
4482
4518
|
spawnSession,
|
|
4483
4519
|
stopSession,
|
|
4484
|
-
requestShutdown: () => requestShutdown("
|
|
4520
|
+
requestShutdown: () => requestShutdown("zenflo-app")
|
|
4485
4521
|
});
|
|
4486
4522
|
apiMachine.connect();
|
|
4487
|
-
const heartbeatIntervalMs = parseInt(process.env.
|
|
4523
|
+
const heartbeatIntervalMs = parseInt(process.env.ZENFLO_DAEMON_HEARTBEAT_INTERVAL || "60000");
|
|
4488
4524
|
let heartbeatRunning = false;
|
|
4489
4525
|
const restartOnStaleVersionAndHeartbeat = setInterval(async () => {
|
|
4490
4526
|
if (heartbeatRunning) {
|
|
@@ -4707,7 +4743,8 @@ function registerKillSessionHandler(rpcHandlerManager, killThisHappy) {
|
|
|
4707
4743
|
|
|
4708
4744
|
async function runClaude(credentials, options = {}) {
|
|
4709
4745
|
const workingDirectory = process.cwd();
|
|
4710
|
-
const
|
|
4746
|
+
const isExtensionMode = options.claudeArgs?.includes("--input-format") && options.claudeArgs?.includes("stream-json");
|
|
4747
|
+
const sessionTag = isExtensionMode ? `extension-${hashObject({ workingDirectory, machineId: (await readSettings())?.machineId })}` : randomUUID();
|
|
4711
4748
|
logger.debugLargeJson("[START] ZenFlo process started", getEnvironmentInfo());
|
|
4712
4749
|
logger.debug(`[START] Options: startedBy=${options.startedBy}, startingMode=${options.startingMode}`);
|
|
4713
4750
|
if (options.startedBy === "daemon" && options.startingMode === "local") {
|
|
@@ -4734,9 +4771,9 @@ async function runClaude(credentials, options = {}) {
|
|
|
4734
4771
|
os: os$1.platform(),
|
|
4735
4772
|
machineId,
|
|
4736
4773
|
homeDir: os$1.homedir(),
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4774
|
+
zenfloHomeDir: configuration.zenfloHomeDir,
|
|
4775
|
+
zenfloLibDir: projectPath(),
|
|
4776
|
+
zenfloToolsDir: resolve(projectPath(), "tools", "unpacked"),
|
|
4740
4777
|
startedFromDaemon: options.startedBy === "daemon",
|
|
4741
4778
|
hostPid: process.pid,
|
|
4742
4779
|
startedBy: options.startedBy || "terminal",
|
|
@@ -5007,7 +5044,7 @@ async function install$1() {
|
|
|
5007
5044
|
|
|
5008
5045
|
<key>EnvironmentVariables</key>
|
|
5009
5046
|
<dict>
|
|
5010
|
-
<key>
|
|
5047
|
+
<key>ZENFLO_DAEMON_MODE</key>
|
|
5011
5048
|
<string>true</string>
|
|
5012
5049
|
</dict>
|
|
5013
5050
|
|
|
@@ -5172,7 +5209,7 @@ async function handleAuthLogin(args) {
|
|
|
5172
5209
|
}
|
|
5173
5210
|
}
|
|
5174
5211
|
async function handleAuthLogout() {
|
|
5175
|
-
const happyDir = configuration.
|
|
5212
|
+
const happyDir = configuration.zenfloHomeDir;
|
|
5176
5213
|
const credentials = await readCredentials();
|
|
5177
5214
|
if (!credentials) {
|
|
5178
5215
|
console.log(chalk.yellow("Not currently authenticated"));
|
|
@@ -5228,7 +5265,7 @@ async function handleAuthStatus() {
|
|
|
5228
5265
|
console.log(chalk.gray(' Run "happy auth login --force" to fix this'));
|
|
5229
5266
|
}
|
|
5230
5267
|
console.log(chalk.gray(`
|
|
5231
|
-
Data directory: ${configuration.
|
|
5268
|
+
Data directory: ${configuration.zenfloHomeDir}`));
|
|
5232
5269
|
try {
|
|
5233
5270
|
const running = await checkIfDaemonRunningAndCleanupStaleState();
|
|
5234
5271
|
if (running) {
|
|
@@ -5757,10 +5794,10 @@ ${chalk.bold("Examples:")}
|
|
|
5757
5794
|
happy connect claude
|
|
5758
5795
|
happy connect gemini
|
|
5759
5796
|
|
|
5760
|
-
${chalk.bold("Notes:")}
|
|
5797
|
+
${chalk.bold("Notes:")}
|
|
5761
5798
|
\u2022 You must be authenticated with Happy first (run 'happy auth login')
|
|
5762
5799
|
\u2022 API keys are encrypted and stored securely in Happy cloud
|
|
5763
|
-
\u2022 You can manage your stored keys at app.
|
|
5800
|
+
\u2022 You can manage your stored keys at app.combinedmemory.com
|
|
5764
5801
|
`);
|
|
5765
5802
|
}
|
|
5766
5803
|
async function handleConnectVendor(vendor, displayName) {
|
|
@@ -5838,7 +5875,7 @@ async function handleConnectVendor(vendor, displayName) {
|
|
|
5838
5875
|
return;
|
|
5839
5876
|
} else if (subcommand === "codex") {
|
|
5840
5877
|
try {
|
|
5841
|
-
const { runCodex } = await import('./runCodex-
|
|
5878
|
+
const { runCodex } = await import('./runCodex-Bl0T0A2Z.mjs');
|
|
5842
5879
|
let startedBy = void 0;
|
|
5843
5880
|
for (let i = 1; i < args.length; i++) {
|
|
5844
5881
|
if (args[i] === "--started-by") {
|
|
@@ -5996,7 +6033,7 @@ ${chalk.bold("To clean up runaway processes:")} Use ${chalk.cyan("happy doctor c
|
|
|
5996
6033
|
} else if (arg === "-v" || arg === "--version") {
|
|
5997
6034
|
showVersion = true;
|
|
5998
6035
|
unknownArgs.push(arg);
|
|
5999
|
-
} else if (arg === "--
|
|
6036
|
+
} else if (arg === "--zenflo-starting-mode") {
|
|
6000
6037
|
options.startingMode = z.enum(["local", "remote"]).parse(args[++i]);
|
|
6001
6038
|
} else if (arg === "--yolo") {
|
|
6002
6039
|
unknownArgs.push("--dangerously-skip-permissions");
|
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
package/dist/lib.cjs
CHANGED
package/dist/lib.d.cts
CHANGED
|
@@ -285,6 +285,21 @@ declare const RawJSONLinesSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
285
285
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
286
286
|
type: z.ZodLiteral<"system">;
|
|
287
287
|
uuid: z.ZodString;
|
|
288
|
+
}, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
|
|
289
|
+
type: z.ZodLiteral<"queue-operation">;
|
|
290
|
+
operation: z.ZodEnum<["enqueue", "dequeue"]>;
|
|
291
|
+
timestamp: z.ZodString;
|
|
292
|
+
sessionId: z.ZodString;
|
|
293
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
294
|
+
type: z.ZodLiteral<"queue-operation">;
|
|
295
|
+
operation: z.ZodEnum<["enqueue", "dequeue"]>;
|
|
296
|
+
timestamp: z.ZodString;
|
|
297
|
+
sessionId: z.ZodString;
|
|
298
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
299
|
+
type: z.ZodLiteral<"queue-operation">;
|
|
300
|
+
operation: z.ZodEnum<["enqueue", "dequeue"]>;
|
|
301
|
+
timestamp: z.ZodString;
|
|
302
|
+
sessionId: z.ZodString;
|
|
288
303
|
}, z.ZodTypeAny, "passthrough">>]>;
|
|
289
304
|
type RawJSONLines = z.infer<typeof RawJSONLinesSchema>;
|
|
290
305
|
|
|
@@ -450,24 +465,24 @@ type Session = {
|
|
|
450
465
|
declare const MachineMetadataSchema: z.ZodObject<{
|
|
451
466
|
host: z.ZodString;
|
|
452
467
|
platform: z.ZodString;
|
|
453
|
-
|
|
468
|
+
zenfloCliVersion: z.ZodString;
|
|
454
469
|
homeDir: z.ZodString;
|
|
455
|
-
|
|
456
|
-
|
|
470
|
+
zenfloHomeDir: z.ZodString;
|
|
471
|
+
zenfloLibDir: z.ZodString;
|
|
457
472
|
}, "strip", z.ZodTypeAny, {
|
|
458
473
|
host: string;
|
|
459
474
|
platform: string;
|
|
460
|
-
|
|
475
|
+
zenfloCliVersion: string;
|
|
461
476
|
homeDir: string;
|
|
462
|
-
|
|
463
|
-
|
|
477
|
+
zenfloHomeDir: string;
|
|
478
|
+
zenfloLibDir: string;
|
|
464
479
|
}, {
|
|
465
480
|
host: string;
|
|
466
481
|
platform: string;
|
|
467
|
-
|
|
482
|
+
zenfloCliVersion: string;
|
|
468
483
|
homeDir: string;
|
|
469
|
-
|
|
470
|
-
|
|
484
|
+
zenfloHomeDir: string;
|
|
485
|
+
zenfloLibDir: string;
|
|
471
486
|
}>;
|
|
472
487
|
type MachineMetadata = z.infer<typeof MachineMetadataSchema>;
|
|
473
488
|
/**
|
|
@@ -597,9 +612,9 @@ type Metadata = {
|
|
|
597
612
|
tools?: string[];
|
|
598
613
|
slashCommands?: string[];
|
|
599
614
|
homeDir: string;
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
615
|
+
zenfloHomeDir: string;
|
|
616
|
+
zenfloLibDir: string;
|
|
617
|
+
zenfloToolsDir: string;
|
|
603
618
|
startedFromDaemon?: boolean;
|
|
604
619
|
hostPid?: number;
|
|
605
620
|
startedBy?: 'daemon' | 'terminal';
|
|
@@ -808,7 +823,7 @@ declare class Configuration {
|
|
|
808
823
|
readonly serverUrl: string;
|
|
809
824
|
readonly webappUrl: string;
|
|
810
825
|
readonly isDaemonProcess: boolean;
|
|
811
|
-
readonly
|
|
826
|
+
readonly zenfloHomeDir: string;
|
|
812
827
|
readonly logsDir: string;
|
|
813
828
|
readonly settingsFile: string;
|
|
814
829
|
readonly privateKeyFile: string;
|
package/dist/lib.d.mts
CHANGED
|
@@ -285,6 +285,21 @@ declare const RawJSONLinesSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
285
285
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
286
286
|
type: z.ZodLiteral<"system">;
|
|
287
287
|
uuid: z.ZodString;
|
|
288
|
+
}, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
|
|
289
|
+
type: z.ZodLiteral<"queue-operation">;
|
|
290
|
+
operation: z.ZodEnum<["enqueue", "dequeue"]>;
|
|
291
|
+
timestamp: z.ZodString;
|
|
292
|
+
sessionId: z.ZodString;
|
|
293
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
294
|
+
type: z.ZodLiteral<"queue-operation">;
|
|
295
|
+
operation: z.ZodEnum<["enqueue", "dequeue"]>;
|
|
296
|
+
timestamp: z.ZodString;
|
|
297
|
+
sessionId: z.ZodString;
|
|
298
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
299
|
+
type: z.ZodLiteral<"queue-operation">;
|
|
300
|
+
operation: z.ZodEnum<["enqueue", "dequeue"]>;
|
|
301
|
+
timestamp: z.ZodString;
|
|
302
|
+
sessionId: z.ZodString;
|
|
288
303
|
}, z.ZodTypeAny, "passthrough">>]>;
|
|
289
304
|
type RawJSONLines = z.infer<typeof RawJSONLinesSchema>;
|
|
290
305
|
|
|
@@ -450,24 +465,24 @@ type Session = {
|
|
|
450
465
|
declare const MachineMetadataSchema: z.ZodObject<{
|
|
451
466
|
host: z.ZodString;
|
|
452
467
|
platform: z.ZodString;
|
|
453
|
-
|
|
468
|
+
zenfloCliVersion: z.ZodString;
|
|
454
469
|
homeDir: z.ZodString;
|
|
455
|
-
|
|
456
|
-
|
|
470
|
+
zenfloHomeDir: z.ZodString;
|
|
471
|
+
zenfloLibDir: z.ZodString;
|
|
457
472
|
}, "strip", z.ZodTypeAny, {
|
|
458
473
|
host: string;
|
|
459
474
|
platform: string;
|
|
460
|
-
|
|
475
|
+
zenfloCliVersion: string;
|
|
461
476
|
homeDir: string;
|
|
462
|
-
|
|
463
|
-
|
|
477
|
+
zenfloHomeDir: string;
|
|
478
|
+
zenfloLibDir: string;
|
|
464
479
|
}, {
|
|
465
480
|
host: string;
|
|
466
481
|
platform: string;
|
|
467
|
-
|
|
482
|
+
zenfloCliVersion: string;
|
|
468
483
|
homeDir: string;
|
|
469
|
-
|
|
470
|
-
|
|
484
|
+
zenfloHomeDir: string;
|
|
485
|
+
zenfloLibDir: string;
|
|
471
486
|
}>;
|
|
472
487
|
type MachineMetadata = z.infer<typeof MachineMetadataSchema>;
|
|
473
488
|
/**
|
|
@@ -597,9 +612,9 @@ type Metadata = {
|
|
|
597
612
|
tools?: string[];
|
|
598
613
|
slashCommands?: string[];
|
|
599
614
|
homeDir: string;
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
615
|
+
zenfloHomeDir: string;
|
|
616
|
+
zenfloLibDir: string;
|
|
617
|
+
zenfloToolsDir: string;
|
|
603
618
|
startedFromDaemon?: boolean;
|
|
604
619
|
hostPid?: number;
|
|
605
620
|
startedBy?: 'daemon' | 'terminal';
|
|
@@ -808,7 +823,7 @@ declare class Configuration {
|
|
|
808
823
|
readonly serverUrl: string;
|
|
809
824
|
readonly webappUrl: string;
|
|
810
825
|
readonly isDaemonProcess: boolean;
|
|
811
|
-
readonly
|
|
826
|
+
readonly zenfloHomeDir: string;
|
|
812
827
|
readonly logsDir: string;
|
|
813
828
|
readonly settingsFile: string;
|
|
814
829
|
readonly privateKeyFile: string;
|
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-DJhJK2jD.mjs';
|
|
2
2
|
import 'axios';
|
|
3
3
|
import 'chalk';
|
|
4
4
|
import '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, b as packageJson } from './types-
|
|
3
|
+
import { l as logger, A as ApiClient, r as readSettings, p as projectPath, c as configuration, b as packageJson } from './types-DJhJK2jD.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 startZenfloServer, 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 startZenfloServer, t as trimIdent, b as stopCaffeinate } from './index-yJG0qz0r.mjs';
|
|
11
11
|
import os from 'node:os';
|
|
12
12
|
import { resolve, join } from 'node:path';
|
|
13
13
|
import fs from 'node:fs';
|
|
@@ -790,9 +790,9 @@ async function runCodex(opts) {
|
|
|
790
790
|
os: os.platform(),
|
|
791
791
|
machineId,
|
|
792
792
|
homeDir: os.homedir(),
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
793
|
+
zenfloHomeDir: configuration.zenfloHomeDir,
|
|
794
|
+
zenfloLibDir: projectPath(),
|
|
795
|
+
zenfloToolsDir: resolve(projectPath(), "tools", "unpacked"),
|
|
796
796
|
startedFromDaemon: opts.startedBy === "daemon",
|
|
797
797
|
hostPid: process.pid,
|
|
798
798
|
startedBy: opts.startedBy || "terminal",
|
|
@@ -1124,11 +1124,28 @@ async function runCodex(opts) {
|
|
|
1124
1124
|
});
|
|
1125
1125
|
const zenfloServer = await startZenfloServer(session, api);
|
|
1126
1126
|
const bridgeCommand = join(projectPath(), "bin", "zenflo-mcp.mjs");
|
|
1127
|
+
const zenModeConfig = {
|
|
1128
|
+
command: "node",
|
|
1129
|
+
args: [join(projectPath(), "..", "zen-mcp", "zen-mode-mcp-server", "dist", "index.js")]
|
|
1130
|
+
};
|
|
1131
|
+
if (process.env.ZENFLO_AUTH_TOKEN || process.env.ZENFLO_SECRET_KEY || process.env.ZENFLO_USER_ID) {
|
|
1132
|
+
zenModeConfig.env = {};
|
|
1133
|
+
if (process.env.ZENFLO_AUTH_TOKEN) {
|
|
1134
|
+
zenModeConfig.env.ZENFLO_AUTH_TOKEN = process.env.ZENFLO_AUTH_TOKEN;
|
|
1135
|
+
}
|
|
1136
|
+
if (process.env.ZENFLO_SECRET_KEY) {
|
|
1137
|
+
zenModeConfig.env.ZENFLO_SECRET_KEY = process.env.ZENFLO_SECRET_KEY;
|
|
1138
|
+
}
|
|
1139
|
+
if (process.env.ZENFLO_USER_ID) {
|
|
1140
|
+
zenModeConfig.env.ZENFLO_USER_ID = process.env.ZENFLO_USER_ID;
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1127
1143
|
const mcpServers = {
|
|
1128
1144
|
happy: {
|
|
1129
1145
|
command: bridgeCommand,
|
|
1130
1146
|
args: ["--url", zenfloServer.url]
|
|
1131
|
-
}
|
|
1147
|
+
},
|
|
1148
|
+
"zen-mode": zenModeConfig
|
|
1132
1149
|
};
|
|
1133
1150
|
let first = true;
|
|
1134
1151
|
try {
|