@zhigang1992/happy-cli 0.12.4 → 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.
@@ -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-Q-euvEmG.cjs');
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');
@@ -1082,7 +1082,7 @@ class AbortError extends Error {
1082
1082
  }
1083
1083
  }
1084
1084
 
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-CHEjP0zg.cjs', document.baseURI).href)));
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)));
1086
1086
  const __dirname$1 = node_path.join(__filename$1, "..");
1087
1087
  function getDefaultClaudeCodePath() {
1088
1088
  return node_path.join(__dirname$1, "..", "..", "..", "node_modules", "@anthropic-ai", "claude-code", "cli.js");
@@ -6393,7 +6393,7 @@ async function handleConnectVendor(vendor, displayName) {
6393
6393
  return;
6394
6394
  } else if (subcommand === "codex") {
6395
6395
  try {
6396
- const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-DUqqO-m8.cjs'); });
6396
+ const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-CLxMptoC.cjs'); });
6397
6397
  let startedBy = void 0;
6398
6398
  for (let i = 1; i < args.length; i++) {
6399
6399
  if (args[i] === "--started-by") {
@@ -6438,7 +6438,7 @@ async function handleConnectVendor(vendor, displayName) {
6438
6438
  } else if (subcommand === "list") {
6439
6439
  try {
6440
6440
  const { credentials } = await authAndSetupMachineIfNeeded();
6441
- const { listSessions } = await Promise.resolve().then(function () { return require('./list-DOsBjFRJ.cjs'); });
6441
+ const { listSessions } = await Promise.resolve().then(function () { return require('./list-BmyKI4UO.cjs'); });
6442
6442
  let sessionId;
6443
6443
  let titleFilter;
6444
6444
  let recentMsgs;
@@ -6540,7 +6540,7 @@ Examples:
6540
6540
  process.exit(1);
6541
6541
  }
6542
6542
  const { credentials } = await authAndSetupMachineIfNeeded();
6543
- const { promptSession } = await Promise.resolve().then(function () { return require('./prompt-Dh_trad0.cjs'); });
6543
+ const { promptSession } = await Promise.resolve().then(function () { return require('./prompt-SOUeW7vB.cjs'); });
6544
6544
  await promptSession(credentials, sessionId, promptText, timeoutMinutes ?? void 0);
6545
6545
  } catch (error) {
6546
6546
  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-Cw6y7GyQ.mjs';
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-BmcSXhbq.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';
@@ -6370,7 +6370,7 @@ async function handleConnectVendor(vendor, displayName) {
6370
6370
  return;
6371
6371
  } else if (subcommand === "codex") {
6372
6372
  try {
6373
- const { runCodex } = await import('./runCodex-CYkmZphO.mjs');
6373
+ const { runCodex } = await import('./runCodex-Cxhf8ktE.mjs');
6374
6374
  let startedBy = void 0;
6375
6375
  for (let i = 1; i < args.length; i++) {
6376
6376
  if (args[i] === "--started-by") {
@@ -6415,7 +6415,7 @@ async function handleConnectVendor(vendor, displayName) {
6415
6415
  } else if (subcommand === "list") {
6416
6416
  try {
6417
6417
  const { credentials } = await authAndSetupMachineIfNeeded();
6418
- const { listSessions } = await import('./list-BvtUKVTq.mjs');
6418
+ const { listSessions } = await import('./list-B0EZS1nk.mjs');
6419
6419
  let sessionId;
6420
6420
  let titleFilter;
6421
6421
  let recentMsgs;
@@ -6517,7 +6517,7 @@ Examples:
6517
6517
  process.exit(1);
6518
6518
  }
6519
6519
  const { credentials } = await authAndSetupMachineIfNeeded();
6520
- const { promptSession } = await import('./prompt-BbMNN7fl.mjs');
6520
+ const { promptSession } = await import('./prompt-COmkBtjd.mjs');
6521
6521
  await promptSession(credentials, sessionId, promptText, timeoutMinutes ?? void 0);
6522
6522
  } catch (error) {
6523
6523
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  require('chalk');
4
- require('./index-CHEjP0zg.cjs');
5
- require('./types-Q-euvEmG.cjs');
4
+ require('./index-B8KwpPnt.cjs');
5
+ require('./types-0ILrOpLt.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-BERBU6rR.mjs';
3
- import './types-Cw6y7GyQ.mjs';
2
+ import './index-BfGA--2C.mjs';
3
+ import './types-BmcSXhbq.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-Q-euvEmG.cjs');
3
+ var types = require('./types-0ILrOpLt.cjs');
4
4
  require('axios');
5
5
  require('chalk');
6
6
  require('fs');
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-Cw6y7GyQ.mjs';
1
+ export { A as ApiClient, a as ApiSessionClient, R as RawJSONLinesSchema, c as configuration, l as logger } from './types-BmcSXhbq.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-Cw6y7GyQ.mjs';
1
+ import { c as configuration, l as logger, d as decodeBase64, b as decrypt, f as formatTimeAgo, e as libsodiumDecryptFromPublicKey } from './types-BmcSXhbq.mjs';
2
2
  import axios from 'axios';
3
3
  import { existsSync, readdirSync, statSync, readFileSync } from 'fs';
4
4
  import { join } from 'path';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var types = require('./types-Q-euvEmG.cjs');
3
+ var types = require('./types-0ILrOpLt.cjs');
4
4
  var axios = require('axios');
5
5
  var fs = require('fs');
6
6
  var path = require('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-Cw6y7GyQ.mjs';
1
+ import { c as configuration, b as decrypt, d as decodeBase64, l as logger, g as encodeBase64, h as encrypt } from './types-BmcSXhbq.mjs';
2
2
  import axios from 'axios';
3
3
  import { io } from 'socket.io-client';
4
4
  import 'chalk';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var types = require('./types-Q-euvEmG.cjs');
3
+ var types = require('./types-0ILrOpLt.cjs');
4
4
  var axios = require('axios');
5
5
  var socket_ioClient = require('socket.io-client');
6
6
  require('chalk');
@@ -2,14 +2,14 @@
2
2
 
3
3
  var ink = require('ink');
4
4
  var React = require('react');
5
- var types = require('./types-Q-euvEmG.cjs');
5
+ var types = require('./types-0ILrOpLt.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-CHEjP0zg.cjs');
12
+ var index = require('./index-B8KwpPnt.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-Cw6y7GyQ.mjs';
3
+ import { l as logger, A as ApiClient, r as readSettings, p as projectPath, c as configuration, i as packageJson } from './types-BmcSXhbq.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-BERBU6rR.mjs';
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-BfGA--2C.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.12.4";
44
+ var version = "0.12.5";
45
45
  var description = "Mobile and Web client for Claude Code and Codex";
46
46
  var author = "Kirill Dubovitskiy";
47
47
  var license = "MIT";
@@ -357,6 +357,18 @@ function decryptBlobWithDataKey(bundle, dataKey) {
357
357
  return null;
358
358
  }
359
359
  }
360
+ function decryptBlobWithSecretBox(bundle, secret) {
361
+ if (bundle.length < 1 + tweetnacl.secretbox.nonceLength) {
362
+ return null;
363
+ }
364
+ if (bundle[0] !== 0) {
365
+ return null;
366
+ }
367
+ const nonce = bundle.slice(1, 1 + tweetnacl.secretbox.nonceLength);
368
+ const ciphertext = bundle.slice(1 + tweetnacl.secretbox.nonceLength);
369
+ const decrypted = tweetnacl.secretbox.open(ciphertext, nonce, secret);
370
+ return decrypted || null;
371
+ }
360
372
  function encrypt(key, variant, data) {
361
373
  if (variant === "legacy") {
362
374
  return encryptLegacy(data, key);
@@ -371,6 +383,13 @@ function decrypt(key, variant, data) {
371
383
  return decryptWithDataKey(data, key);
372
384
  }
373
385
  }
386
+ function decryptBlob(key, variant, bundle) {
387
+ if (variant === "legacy") {
388
+ return decryptBlobWithSecretBox(bundle, key);
389
+ } else {
390
+ return decryptBlobWithDataKey(bundle, key);
391
+ }
392
+ }
374
393
  function authChallenge(secret) {
375
394
  const keypair = tweetnacl.sign.keyPair.fromSeed(secret);
376
395
  const challenge = getRandomBytes(32);
@@ -1130,7 +1149,7 @@ class RpcHandlerManager {
1130
1149
  }
1131
1150
  }
1132
1151
 
1133
- 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-Q-euvEmG.cjs', document.baseURI).href))));
1152
+ 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-0ILrOpLt.cjs', document.baseURI).href))));
1134
1153
  function projectPath() {
1135
1154
  const path$1 = path.resolve(__dirname$1, "..");
1136
1155
  return path$1;
@@ -1783,11 +1802,7 @@ class ApiSessionClient extends node_events.EventEmitter {
1783
1802
  const encryptedData = new Uint8Array(response.data);
1784
1803
  const mimeType = response.headers["x-blob-mimetype"];
1785
1804
  const originalSize = parseInt(response.headers["x-blob-size"], 10);
1786
- if (this.encryptionVariant !== "dataKey") {
1787
- logger.debug("[API] Cannot decrypt blob: session uses legacy encryption");
1788
- return null;
1789
- }
1790
- const decryptedData = decryptBlobWithDataKey(encryptedData, this.encryptionKey);
1805
+ const decryptedData = decryptBlob(this.encryptionKey, this.encryptionVariant, encryptedData);
1791
1806
  if (!decryptedData) {
1792
1807
  logger.debug("[API] Failed to decrypt blob");
1793
1808
  return null;
@@ -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.12.4";
23
+ var version = "0.12.5";
24
24
  var description = "Mobile and Web client for Claude Code and Codex";
25
25
  var author = "Kirill Dubovitskiy";
26
26
  var license = "MIT";
@@ -336,6 +336,18 @@ function decryptBlobWithDataKey(bundle, dataKey) {
336
336
  return null;
337
337
  }
338
338
  }
339
+ function decryptBlobWithSecretBox(bundle, secret) {
340
+ if (bundle.length < 1 + tweetnacl.secretbox.nonceLength) {
341
+ return null;
342
+ }
343
+ if (bundle[0] !== 0) {
344
+ return null;
345
+ }
346
+ const nonce = bundle.slice(1, 1 + tweetnacl.secretbox.nonceLength);
347
+ const ciphertext = bundle.slice(1 + tweetnacl.secretbox.nonceLength);
348
+ const decrypted = tweetnacl.secretbox.open(ciphertext, nonce, secret);
349
+ return decrypted || null;
350
+ }
339
351
  function encrypt(key, variant, data) {
340
352
  if (variant === "legacy") {
341
353
  return encryptLegacy(data, key);
@@ -350,6 +362,13 @@ function decrypt(key, variant, data) {
350
362
  return decryptWithDataKey(data, key);
351
363
  }
352
364
  }
365
+ function decryptBlob(key, variant, bundle) {
366
+ if (variant === "legacy") {
367
+ return decryptBlobWithSecretBox(bundle, key);
368
+ } else {
369
+ return decryptBlobWithDataKey(bundle, key);
370
+ }
371
+ }
353
372
  function authChallenge(secret) {
354
373
  const keypair = tweetnacl.sign.keyPair.fromSeed(secret);
355
374
  const challenge = getRandomBytes(32);
@@ -1762,11 +1781,7 @@ class ApiSessionClient extends EventEmitter {
1762
1781
  const encryptedData = new Uint8Array(response.data);
1763
1782
  const mimeType = response.headers["x-blob-mimetype"];
1764
1783
  const originalSize = parseInt(response.headers["x-blob-size"], 10);
1765
- if (this.encryptionVariant !== "dataKey") {
1766
- logger.debug("[API] Cannot decrypt blob: session uses legacy encryption");
1767
- return null;
1768
- }
1769
- const decryptedData = decryptBlobWithDataKey(encryptedData, this.encryptionKey);
1784
+ const decryptedData = decryptBlob(this.encryptionKey, this.encryptionVariant, encryptedData);
1770
1785
  if (!decryptedData) {
1771
1786
  logger.debug("[API] Failed to decrypt blob");
1772
1787
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhigang1992/happy-cli",
3
- "version": "0.12.4",
3
+ "version": "0.12.5",
4
4
  "description": "Mobile and Web client for Claude Code and Codex",
5
5
  "author": "Kirill Dubovitskiy",
6
6
  "license": "MIT",