zenflo 0.11.6 → 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.
@@ -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-DjiA-t1_.mjs';
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 "mcp__happy__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.
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 Happy like so:
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 [Happy](https://happy.engineering)
216
+ via [ZenFlo](https://zenflo.app)
206
217
 
207
218
  Co-Authored-By: Claude <noreply@anthropic.com>
208
- Co-Authored-By: Happy <yesreply@happy.engineering>
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
- process.stdin.pause();
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) {
@@ -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
- process.stdin.resume();
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.debugLargeJson(`[SESSION_SCANNER] Failed to parse message`, message);
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 HAPPY_DISABLE_CAFFEINATE environment variable");
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.HAPPY_DAEMON_HTTP_TIMEOUT ? parseInt(process.env.HAPPY_DAEMON_HTTP_TIMEOUT) : 1e4;
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" },
@@ -3538,7 +3577,7 @@ function getEnvironmentInfo() {
3538
3577
  DEBUG: process.env.DEBUG,
3539
3578
  workingDirectory: process.cwd(),
3540
3579
  processArgv: process.argv,
3541
- happyDir: configuration?.happyHomeDir,
3580
+ happyDir: configuration?.zenfloHomeDir,
3542
3581
  serverUrl: configuration?.serverUrl,
3543
3582
  logsDir: configuration?.logsDir,
3544
3583
  processPid: process.pid,
@@ -3587,7 +3626,7 @@ async function runDoctorCommand(filter) {
3587
3626
  console.log(`CLI Exists: ${existsSync(cliEntrypoint) ? chalk.green("\u2713 Yes") : chalk.red("\u274C No")}`);
3588
3627
  console.log("");
3589
3628
  console.log(chalk.bold("\u2699\uFE0F Configuration"));
3590
- console.log(`Happy Home: ${chalk.blue(configuration.happyHomeDir)}`);
3629
+ console.log(`Happy Home: ${chalk.blue(configuration.zenfloHomeDir)}`);
3591
3630
  console.log(`Server URL: ${chalk.blue(configuration.serverUrl)}`);
3592
3631
  console.log(`Logs Dir: ${chalk.blue(configuration.logsDir)}`);
3593
3632
  console.log(chalk.bold("\n\u{1F30D} Environment Variables"));
@@ -4010,7 +4049,7 @@ function startDaemonControlServer({
4010
4049
  stopSession,
4011
4050
  spawnSession,
4012
4051
  requestShutdown,
4013
- onHappySessionWebhook
4052
+ onZenfloSessionWebhook
4014
4053
  }) {
4015
4054
  return new Promise((resolve) => {
4016
4055
  const app = fastify({
@@ -4036,7 +4075,7 @@ function startDaemonControlServer({
4036
4075
  }, async (request) => {
4037
4076
  const { sessionId, metadata } = request.body;
4038
4077
  logger.debug(`[CONTROL SERVER] Session started: ${sessionId}`);
4039
- onHappySessionWebhook(sessionId, metadata);
4078
+ onZenfloSessionWebhook(sessionId, metadata);
4040
4079
  return { status: "ok" };
4041
4080
  });
4042
4081
  typed.post("/list", {
@@ -4175,10 +4214,10 @@ function startDaemonControlServer({
4175
4214
  const initialMachineMetadata = {
4176
4215
  host: os.hostname(),
4177
4216
  platform: os.platform(),
4178
- happyCliVersion: packageJson.version,
4217
+ zenfloCliVersion: packageJson.version,
4179
4218
  homeDir: os.homedir(),
4180
- happyHomeDir: configuration.happyHomeDir,
4181
- happyLibDir: projectPath()
4219
+ zenfloHomeDir: configuration.zenfloHomeDir,
4220
+ zenfloLibDir: projectPath()
4182
4221
  };
4183
4222
  async function startDaemon() {
4184
4223
  let requestShutdown;
@@ -4245,7 +4284,7 @@ async function startDaemon() {
4245
4284
  const pidToTrackedSession = /* @__PURE__ */ new Map();
4246
4285
  const pidToAwaiter = /* @__PURE__ */ new Map();
4247
4286
  const getCurrentChildren = () => Array.from(pidToTrackedSession.values());
4248
- const onHappySessionWebhook = (sessionId, sessionMetadata) => {
4287
+ const onZenfloSessionWebhook = (sessionId, sessionMetadata) => {
4249
4288
  logger.debugLargeJson(`[DAEMON RUN] Session reported`, sessionMetadata);
4250
4289
  const pid = sessionMetadata.hostPid;
4251
4290
  if (!pid) {
@@ -4267,7 +4306,7 @@ async function startDaemon() {
4267
4306
  }
4268
4307
  } else if (!existingSession) {
4269
4308
  const trackedSession = {
4270
- startedBy: "happy directly - likely by user from terminal",
4309
+ startedBy: "zenflo directly - likely by user from terminal",
4271
4310
  zenfloSessionId: sessionId,
4272
4311
  zenfloSessionMetadataFromLocalWebhook: sessionMetadata,
4273
4312
  pid
@@ -4332,8 +4371,9 @@ async function startDaemon() {
4332
4371
  }
4333
4372
  }
4334
4373
  const args = [
4335
- options.agent === "claude" ? "claude" : "codex",
4336
- "--happy-starting-mode",
4374
+ options.agent || "claude",
4375
+ // Use the agent directly (claude, codex, qwen, gemini)
4376
+ "--zenflo-starting-mode",
4337
4377
  "remote",
4338
4378
  "--started-by",
4339
4379
  "daemon"
@@ -4448,8 +4488,8 @@ async function startDaemon() {
4448
4488
  getChildren: getCurrentChildren,
4449
4489
  stopSession,
4450
4490
  spawnSession,
4451
- requestShutdown: () => requestShutdown("happy-cli"),
4452
- onHappySessionWebhook
4491
+ requestShutdown: () => requestShutdown("zenflo-cli"),
4492
+ onZenfloSessionWebhook
4453
4493
  });
4454
4494
  const fileState = {
4455
4495
  pid: process.pid,
@@ -4477,10 +4517,10 @@ async function startDaemon() {
4477
4517
  apiMachine.setRPCHandlers({
4478
4518
  spawnSession,
4479
4519
  stopSession,
4480
- requestShutdown: () => requestShutdown("happy-app")
4520
+ requestShutdown: () => requestShutdown("zenflo-app")
4481
4521
  });
4482
4522
  apiMachine.connect();
4483
- const heartbeatIntervalMs = parseInt(process.env.HAPPY_DAEMON_HEARTBEAT_INTERVAL || "60000");
4523
+ const heartbeatIntervalMs = parseInt(process.env.ZENFLO_DAEMON_HEARTBEAT_INTERVAL || "60000");
4484
4524
  let heartbeatRunning = false;
4485
4525
  const restartOnStaleVersionAndHeartbeat = setInterval(async () => {
4486
4526
  if (heartbeatRunning) {
@@ -4703,7 +4743,8 @@ function registerKillSessionHandler(rpcHandlerManager, killThisHappy) {
4703
4743
 
4704
4744
  async function runClaude(credentials, options = {}) {
4705
4745
  const workingDirectory = process.cwd();
4706
- const sessionTag = randomUUID();
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();
4707
4748
  logger.debugLargeJson("[START] ZenFlo process started", getEnvironmentInfo());
4708
4749
  logger.debug(`[START] Options: startedBy=${options.startedBy}, startingMode=${options.startingMode}`);
4709
4750
  if (options.startedBy === "daemon" && options.startingMode === "local") {
@@ -4730,9 +4771,9 @@ async function runClaude(credentials, options = {}) {
4730
4771
  os: os$1.platform(),
4731
4772
  machineId,
4732
4773
  homeDir: os$1.homedir(),
4733
- happyHomeDir: configuration.happyHomeDir,
4734
- happyLibDir: projectPath(),
4735
- happyToolsDir: resolve(projectPath(), "tools", "unpacked"),
4774
+ zenfloHomeDir: configuration.zenfloHomeDir,
4775
+ zenfloLibDir: projectPath(),
4776
+ zenfloToolsDir: resolve(projectPath(), "tools", "unpacked"),
4736
4777
  startedFromDaemon: options.startedBy === "daemon",
4737
4778
  hostPid: process.pid,
4738
4779
  startedBy: options.startedBy || "terminal",
@@ -5003,7 +5044,7 @@ async function install$1() {
5003
5044
 
5004
5045
  <key>EnvironmentVariables</key>
5005
5046
  <dict>
5006
- <key>HAPPY_DAEMON_MODE</key>
5047
+ <key>ZENFLO_DAEMON_MODE</key>
5007
5048
  <string>true</string>
5008
5049
  </dict>
5009
5050
 
@@ -5168,7 +5209,7 @@ async function handleAuthLogin(args) {
5168
5209
  }
5169
5210
  }
5170
5211
  async function handleAuthLogout() {
5171
- const happyDir = configuration.happyHomeDir;
5212
+ const happyDir = configuration.zenfloHomeDir;
5172
5213
  const credentials = await readCredentials();
5173
5214
  if (!credentials) {
5174
5215
  console.log(chalk.yellow("Not currently authenticated"));
@@ -5224,7 +5265,7 @@ async function handleAuthStatus() {
5224
5265
  console.log(chalk.gray(' Run "happy auth login --force" to fix this'));
5225
5266
  }
5226
5267
  console.log(chalk.gray(`
5227
- Data directory: ${configuration.happyHomeDir}`));
5268
+ Data directory: ${configuration.zenfloHomeDir}`));
5228
5269
  try {
5229
5270
  const running = await checkIfDaemonRunningAndCleanupStaleState();
5230
5271
  if (running) {
@@ -5753,10 +5794,10 @@ ${chalk.bold("Examples:")}
5753
5794
  happy connect claude
5754
5795
  happy connect gemini
5755
5796
 
5756
- ${chalk.bold("Notes:")}
5797
+ ${chalk.bold("Notes:")}
5757
5798
  \u2022 You must be authenticated with Happy first (run 'happy auth login')
5758
5799
  \u2022 API keys are encrypted and stored securely in Happy cloud
5759
- \u2022 You can manage your stored keys at app.happy.engineering
5800
+ \u2022 You can manage your stored keys at app.combinedmemory.com
5760
5801
  `);
5761
5802
  }
5762
5803
  async function handleConnectVendor(vendor, displayName) {
@@ -5834,7 +5875,7 @@ async function handleConnectVendor(vendor, displayName) {
5834
5875
  return;
5835
5876
  } else if (subcommand === "codex") {
5836
5877
  try {
5837
- const { runCodex } = await import('./runCodex-DrAbIuHU.mjs');
5878
+ const { runCodex } = await import('./runCodex-Bl0T0A2Z.mjs');
5838
5879
  let startedBy = void 0;
5839
5880
  for (let i = 1; i < args.length; i++) {
5840
5881
  if (args[i] === "--started-by") {
@@ -5992,7 +6033,7 @@ ${chalk.bold("To clean up runaway processes:")} Use ${chalk.cyan("happy doctor c
5992
6033
  } else if (arg === "-v" || arg === "--version") {
5993
6034
  showVersion = true;
5994
6035
  unknownArgs.push(arg);
5995
- } else if (arg === "--happy-starting-mode") {
6036
+ } else if (arg === "--zenflo-starting-mode") {
5996
6037
  options.startingMode = z.enum(["local", "remote"]).parse(args[++i]);
5997
6038
  } else if (arg === "--yolo") {
5998
6039
  unknownArgs.push("--dangerously-skip-permissions");
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  require('chalk');
4
- require('./index-BtMdJglm.cjs');
5
- require('./types-CJaqq466.cjs');
4
+ require('./index-HBSmEvnF.cjs');
5
+ require('./types-Dvhor4zW.cjs');
6
6
  require('zod');
7
7
  require('node:child_process');
8
8
  require('node:os');
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import 'chalk';
2
- import './index-QlmPnTH6.mjs';
3
- import './types-DjiA-t1_.mjs';
2
+ import './index-yJG0qz0r.mjs';
3
+ import './types-DJhJK2jD.mjs';
4
4
  import 'zod';
5
5
  import 'node:child_process';
6
6
  import 'node:os';
package/dist/lib.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var types = require('./types-CJaqq466.cjs');
3
+ var types = require('./types-Dvhor4zW.cjs');
4
4
  require('axios');
5
5
  require('chalk');
6
6
  require('fs');
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
- happyCliVersion: z.ZodString;
468
+ zenfloCliVersion: z.ZodString;
454
469
  homeDir: z.ZodString;
455
- happyHomeDir: z.ZodString;
456
- happyLibDir: z.ZodString;
470
+ zenfloHomeDir: z.ZodString;
471
+ zenfloLibDir: z.ZodString;
457
472
  }, "strip", z.ZodTypeAny, {
458
473
  host: string;
459
474
  platform: string;
460
- happyCliVersion: string;
475
+ zenfloCliVersion: string;
461
476
  homeDir: string;
462
- happyHomeDir: string;
463
- happyLibDir: string;
477
+ zenfloHomeDir: string;
478
+ zenfloLibDir: string;
464
479
  }, {
465
480
  host: string;
466
481
  platform: string;
467
- happyCliVersion: string;
482
+ zenfloCliVersion: string;
468
483
  homeDir: string;
469
- happyHomeDir: string;
470
- happyLibDir: string;
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
- happyHomeDir: string;
601
- happyLibDir: string;
602
- happyToolsDir: string;
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 happyHomeDir: string;
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
- happyCliVersion: z.ZodString;
468
+ zenfloCliVersion: z.ZodString;
454
469
  homeDir: z.ZodString;
455
- happyHomeDir: z.ZodString;
456
- happyLibDir: z.ZodString;
470
+ zenfloHomeDir: z.ZodString;
471
+ zenfloLibDir: z.ZodString;
457
472
  }, "strip", z.ZodTypeAny, {
458
473
  host: string;
459
474
  platform: string;
460
- happyCliVersion: string;
475
+ zenfloCliVersion: string;
461
476
  homeDir: string;
462
- happyHomeDir: string;
463
- happyLibDir: string;
477
+ zenfloHomeDir: string;
478
+ zenfloLibDir: string;
464
479
  }, {
465
480
  host: string;
466
481
  platform: string;
467
- happyCliVersion: string;
482
+ zenfloCliVersion: string;
468
483
  homeDir: string;
469
- happyHomeDir: string;
470
- happyLibDir: string;
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
- happyHomeDir: string;
601
- happyLibDir: string;
602
- happyToolsDir: string;
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 happyHomeDir: string;
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-DjiA-t1_.mjs';
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-DjiA-t1_.mjs';
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-QlmPnTH6.mjs';
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
- happyHomeDir: configuration.happyHomeDir,
794
- happyLibDir: projectPath(),
795
- happyToolsDir: resolve(projectPath(), "tools", "unpacked"),
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 {
@@ -2,14 +2,14 @@
2
2
 
3
3
  var ink = require('ink');
4
4
  var React = require('react');
5
- var types = require('./types-CJaqq466.cjs');
5
+ var types = require('./types-Dvhor4zW.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-BtMdJglm.cjs');
12
+ var index = require('./index-HBSmEvnF.cjs');
13
13
  var os = require('node:os');
14
14
  var node_path = require('node:path');
15
15
  var fs = require('node:fs');
@@ -792,9 +792,9 @@ async function runCodex(opts) {
792
792
  os: os.platform(),
793
793
  machineId,
794
794
  homeDir: os.homedir(),
795
- happyHomeDir: types.configuration.happyHomeDir,
796
- happyLibDir: types.projectPath(),
797
- happyToolsDir: node_path.resolve(types.projectPath(), "tools", "unpacked"),
795
+ zenfloHomeDir: types.configuration.zenfloHomeDir,
796
+ zenfloLibDir: types.projectPath(),
797
+ zenfloToolsDir: node_path.resolve(types.projectPath(), "tools", "unpacked"),
798
798
  startedFromDaemon: opts.startedBy === "daemon",
799
799
  hostPid: process.pid,
800
800
  startedBy: opts.startedBy || "terminal",
@@ -1126,11 +1126,28 @@ async function runCodex(opts) {
1126
1126
  });
1127
1127
  const zenfloServer = await index.startZenfloServer(session, api);
1128
1128
  const bridgeCommand = node_path.join(types.projectPath(), "bin", "zenflo-mcp.mjs");
1129
+ const zenModeConfig = {
1130
+ command: "node",
1131
+ args: [node_path.join(types.projectPath(), "..", "zen-mcp", "zen-mode-mcp-server", "dist", "index.js")]
1132
+ };
1133
+ if (process.env.ZENFLO_AUTH_TOKEN || process.env.ZENFLO_SECRET_KEY || process.env.ZENFLO_USER_ID) {
1134
+ zenModeConfig.env = {};
1135
+ if (process.env.ZENFLO_AUTH_TOKEN) {
1136
+ zenModeConfig.env.ZENFLO_AUTH_TOKEN = process.env.ZENFLO_AUTH_TOKEN;
1137
+ }
1138
+ if (process.env.ZENFLO_SECRET_KEY) {
1139
+ zenModeConfig.env.ZENFLO_SECRET_KEY = process.env.ZENFLO_SECRET_KEY;
1140
+ }
1141
+ if (process.env.ZENFLO_USER_ID) {
1142
+ zenModeConfig.env.ZENFLO_USER_ID = process.env.ZENFLO_USER_ID;
1143
+ }
1144
+ }
1129
1145
  const mcpServers = {
1130
1146
  happy: {
1131
1147
  command: bridgeCommand,
1132
1148
  args: ["--url", zenfloServer.url]
1133
- }
1149
+ },
1150
+ "zen-mode": zenModeConfig
1134
1151
  };
1135
1152
  let first = true;
1136
1153
  try {