happy-imou-cloud 2.0.0 → 2.0.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.
Files changed (27) hide show
  1. package/dist/{BaseReasoningProcessor-BRCQXCZY.cjs → BaseReasoningProcessor-01KqA3Kz.cjs} +96 -9
  2. package/dist/{BaseReasoningProcessor-BKLRCKTU.mjs → BaseReasoningProcessor-DQE2l7Xu.mjs} +95 -10
  3. package/dist/{api-BGXYX0yH.mjs → api-B5Ui8Fw0.mjs} +68 -6
  4. package/dist/{api-D7OK-mML.cjs → api-B8v4tczT.cjs} +70 -5
  5. package/dist/{command-CnLtKtP-.mjs → command-BfIuJmeo.mjs} +3 -3
  6. package/dist/{command-G85giEAF.cjs → command-D8yNlaDo.cjs} +3 -3
  7. package/dist/{index-C7Y0R-MI.mjs → index-BByhFIIq.mjs} +682 -220
  8. package/dist/{index-B_wlQBy2.cjs → index-BOqJ9hwi.cjs} +684 -220
  9. package/dist/index.cjs +4 -4
  10. package/dist/index.mjs +4 -4
  11. package/dist/lib.cjs +1 -1
  12. package/dist/lib.d.cts +1 -0
  13. package/dist/lib.d.mts +1 -0
  14. package/dist/lib.mjs +1 -1
  15. package/dist/{persistence-DHgf1CTG.cjs → persistence-C33AMdtv.cjs} +1 -1
  16. package/dist/{persistence-BA_unuca.mjs → persistence-CzpZpiL3.mjs} +1 -1
  17. package/dist/{registerKillSessionHandler-CLREXN11.cjs → registerKillSessionHandler-BkzQulD9.cjs} +6 -4
  18. package/dist/{registerKillSessionHandler-C2-yHm1V.mjs → registerKillSessionHandler-BtSK7IOa.mjs} +6 -4
  19. package/dist/{runClaude-CwAitpX-.cjs → runClaude-CNVufgZb.cjs} +14 -6
  20. package/dist/{runClaude-uNC5Eym4.mjs → runClaude-C_WLfM6c.mjs} +13 -5
  21. package/dist/{runCodex-B-05E-YZ.mjs → runCodex-8eWjTPJr.mjs} +636 -819
  22. package/dist/{runCodex-Cm0VTqw_.cjs → runCodex-Dzy8anlX.cjs} +639 -819
  23. package/dist/{runGemini-CLWjwDYS.cjs → runGemini-CgsVKP7m.cjs} +20 -16
  24. package/dist/{runGemini-_biXvQAH.mjs → runGemini-nbr0mm-S.mjs} +20 -16
  25. package/package.json +14 -14
  26. package/scripts/env-wrapper.cjs +11 -11
  27. package/scripts/setup-dev.cjs +4 -4
@@ -3,11 +3,11 @@
3
3
  var ink = require('ink');
4
4
  var React = require('react');
5
5
  var node_crypto = require('node:crypto');
6
- var api = require('./api-D7OK-mML.cjs');
7
- var persistence = require('./persistence-DHgf1CTG.cjs');
8
- var BaseReasoningProcessor = require('./BaseReasoningProcessor-BRCQXCZY.cjs');
9
- var index = require('./index-B_wlQBy2.cjs');
10
- var registerKillSessionHandler = require('./registerKillSessionHandler-CLREXN11.cjs');
6
+ var api = require('./api-B8v4tczT.cjs');
7
+ var persistence = require('./persistence-C33AMdtv.cjs');
8
+ var BaseReasoningProcessor = require('./BaseReasoningProcessor-01KqA3Kz.cjs');
9
+ var index = require('./index-BOqJ9hwi.cjs');
10
+ var registerKillSessionHandler = require('./registerKillSessionHandler-BkzQulD9.cjs');
11
11
  require('axios');
12
12
  require('chalk');
13
13
  require('fs');
@@ -260,16 +260,12 @@ class GeminiPermissionHandler extends BaseReasoningProcessor.BasePermissionHandl
260
260
  decision: this.currentPermissionMode === "yolo" ? "approved_for_session" : "approved"
261
261
  };
262
262
  }
263
- return new Promise((resolve, reject) => {
264
- this.pendingRequests.set(toolCallId, {
265
- resolve,
266
- reject,
267
- toolName,
268
- input
269
- });
270
- this.addPendingRequestToState(toolCallId, toolName, input);
271
- api.logger.debug(`${this.getLogPrefix()} Permission request sent for tool: ${toolName} (${toolCallId}) in ${this.currentPermissionMode} mode`);
272
- });
263
+ return this.registerPendingRequest(
264
+ toolCallId,
265
+ toolName,
266
+ input,
267
+ ` in ${this.currentPermissionMode} mode`
268
+ );
273
269
  }
274
270
  }
275
271
 
@@ -609,7 +605,15 @@ async function runGemini(opts) {
609
605
  machineId,
610
606
  startedBy: opts.startedBy
611
607
  });
612
- const response = await api$1.getOrCreateSession({ tag: sessionTag, metadata, state });
608
+ let response = null;
609
+ try {
610
+ response = await api$1.getOrCreateSession({ tag: sessionTag, metadata, state });
611
+ } catch (error) {
612
+ if (!api.isAuthenticationRequiredError(error)) {
613
+ throw error;
614
+ }
615
+ api.logger.debug("[Gemini] Falling back to offline session stub after authentication failure");
616
+ }
613
617
  let session;
614
618
  let permissionHandler;
615
619
  let isProcessingMessage = false;
@@ -1,11 +1,11 @@
1
1
  import { useStdout, useInput, Box, Text, render } from 'ink';
2
2
  import React, { useState, useRef, useEffect, useCallback } from 'react';
3
3
  import { randomUUID } from 'node:crypto';
4
- import { l as logger, b as connectionState, A as ApiClient } from './api-BGXYX0yH.mjs';
5
- import { readSettings } from './persistence-BA_unuca.mjs';
6
- import { B as BasePermissionHandler, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-BKLRCKTU.mjs';
7
- import { i as initialMachineMetadata, n as notifyDaemonSessionStarted, g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, s as saveGeminiModelToConfig, a as createGeminiBackend, b as stopCaffeinate } from './index-C7Y0R-MI.mjs';
8
- import { M as MessageQueue2, h as hashObject, a as MessageBuffer, r as registerKillSessionHandler } from './registerKillSessionHandler-C2-yHm1V.mjs';
4
+ import { l as logger, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-B5Ui8Fw0.mjs';
5
+ import { readSettings } from './persistence-CzpZpiL3.mjs';
6
+ import { B as BasePermissionHandler, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-DQE2l7Xu.mjs';
7
+ import { i as initialMachineMetadata, n as notifyDaemonSessionStarted, g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, s as saveGeminiModelToConfig, a as createGeminiBackend, b as stopCaffeinate } from './index-BByhFIIq.mjs';
8
+ import { M as MessageQueue2, h as hashObject, a as MessageBuffer, r as registerKillSessionHandler } from './registerKillSessionHandler-BtSK7IOa.mjs';
9
9
  import 'axios';
10
10
  import 'chalk';
11
11
  import 'fs';
@@ -258,16 +258,12 @@ class GeminiPermissionHandler extends BasePermissionHandler {
258
258
  decision: this.currentPermissionMode === "yolo" ? "approved_for_session" : "approved"
259
259
  };
260
260
  }
261
- return new Promise((resolve, reject) => {
262
- this.pendingRequests.set(toolCallId, {
263
- resolve,
264
- reject,
265
- toolName,
266
- input
267
- });
268
- this.addPendingRequestToState(toolCallId, toolName, input);
269
- logger.debug(`${this.getLogPrefix()} Permission request sent for tool: ${toolName} (${toolCallId}) in ${this.currentPermissionMode} mode`);
270
- });
261
+ return this.registerPendingRequest(
262
+ toolCallId,
263
+ toolName,
264
+ input,
265
+ ` in ${this.currentPermissionMode} mode`
266
+ );
271
267
  }
272
268
  }
273
269
 
@@ -607,7 +603,15 @@ async function runGemini(opts) {
607
603
  machineId,
608
604
  startedBy: opts.startedBy
609
605
  });
610
- const response = await api.getOrCreateSession({ tag: sessionTag, metadata, state });
606
+ let response = null;
607
+ try {
608
+ response = await api.getOrCreateSession({ tag: sessionTag, metadata, state });
609
+ } catch (error) {
610
+ if (!isAuthenticationRequiredError(error)) {
611
+ throw error;
612
+ }
613
+ logger.debug("[Gemini] Falling back to offline session stub after authentication failure");
614
+ }
611
615
  let session;
612
616
  let permissionHandler;
613
617
  let isProcessingMessage = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "happy-imou-cloud",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI",
5
5
  "author": "long.zhu",
6
6
  "license": "MIT",
@@ -45,24 +45,24 @@
45
45
  "typecheck": "tsc --noEmit",
46
46
  "build": "shx rm -rf dist && npx tsc --noEmit && pkgroll",
47
47
  "// ==== Testing ====": "",
48
- "test": "yarn build && vitest run",
49
- "test:integration": "yarn build && vitest run --config vitest.integration.config.ts",
48
+ "test": "yarn build && vitest run",
49
+ "test:integration": "yarn build && vitest run --config vitest.integration.config.ts",
50
50
  "test:integration:watch": "vitest run --config vitest.integration.config.ts --watch",
51
- "test:coverage": "yarn build && vitest run --coverage && node scripts/generate-coverage-report.js",
51
+ "test:coverage": "yarn build && vitest run --coverage && node scripts/generate-coverage-report.js",
52
52
  "// ==== Benchmarks ====": "",
53
- "bench": "yarn build && vitest bench src/daemon/integration/benchmarks/",
54
- "bench:auth": "yarn build && vitest bench src/daemon/integration/benchmarks/auth.bench.ts",
53
+ "bench": "yarn build && vitest bench src/daemon/integration/benchmarks/",
54
+ "bench:auth": "yarn build && vitest bench src/daemon/integration/benchmarks/auth.bench.ts",
55
55
  "bench:report": "node scripts/generate-benchmark-report.js",
56
56
  "// ==== Start & Dev ====": "",
57
- "start": "yarn build && node ./bin/happy-cloud.mjs",
57
+ "start": "yarn build && node ./bin/happy-cloud.mjs",
58
58
  "dev": "tsx src/index.ts",
59
- "dev:local-server": "yarn build && tsx --env-file .env.dev-local-server src/index.ts",
60
- "dev:integration-test-env": "yarn build && tsx --env-file .env.integration-test src/index.ts",
59
+ "dev:local-server": "yarn build && tsx --env-file .env.dev-local-server src/index.ts",
60
+ "dev:integration-test-env": "yarn build && tsx --env-file .env.integration-test src/index.ts",
61
61
  "// ==== Release ====": "",
62
- "prepublishOnly": "npm run build",
63
- "release": "yarn install && release-it",
64
- "release:smoke": "node ./scripts/release-smoke.mjs",
65
- "// ==== Dev/Stable Variant Management ====": "",
62
+ "prepublishOnly": "npm run build",
63
+ "release": "yarn install && release-it",
64
+ "release:smoke": "node ./scripts/release-smoke.mjs",
65
+ "// ==== Dev/Stable Variant Management ====": "",
66
66
  "stable": "node scripts/env-wrapper.cjs stable",
67
67
  "dev:variant": "node scripts/env-wrapper.cjs dev",
68
68
  "// ==== Stable Version Quick Commands ====": "",
@@ -83,7 +83,7 @@
83
83
  "unlink:dev": "node scripts/link-dev.cjs unlink"
84
84
  },
85
85
  "dependencies": {
86
- "@agentclientprotocol/sdk": "^0.8.0",
86
+ "@agentclientprotocol/sdk": "^0.14.1",
87
87
  "@modelcontextprotocol/sdk": "^1.25.3",
88
88
  "@stablelib/base64": "^2.0.1",
89
89
  "@stablelib/hex": "^2.0.1",
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
3
  * Cross-platform environment wrapper for happy CLI
4
- * Sets HAPPY_HOME_DIR and provides visual feedback
4
+ * Sets HAPPY_CLOUD_HOME_DIR and provides visual feedback
5
5
  *
6
6
  * Usage: node scripts/env-wrapper.js <variant> <command> [...args]
7
7
  *
8
8
  * Variants:
9
- * - stable: Production-ready version using ~/.happy/
10
- * - dev: Development version using ~/.happy-dev/
9
+ * - stable: Production-ready version using ~/.happy-cloud/
10
+ * - dev: Development version using ~/.happy-cloud-dev/
11
11
  *
12
12
  * Examples:
13
13
  * node scripts/env-wrapper.js stable daemon start
@@ -21,16 +21,16 @@ const fs = require('fs');
21
21
 
22
22
  const VARIANTS = {
23
23
  stable: {
24
- homeDir: path.join(os.homedir(), '.happy'),
24
+ homeDir: path.join(os.homedir(), '.happy-cloud'),
25
25
  color: '\x1b[32m', // Green
26
26
  label: '✅ STABLE',
27
- serverUrl: process.env.HAPPY_SERVER_URL || 'https://happycloudcode.imou.com'
27
+ serverUrl: process.env.HAPPY_CLOUD_SERVER_URL || process.env.HAPPY_SERVER_URL || 'https://happycloudcode.imou.com'
28
28
  },
29
29
  dev: {
30
- homeDir: path.join(os.homedir(), '.happy-dev'),
30
+ homeDir: path.join(os.homedir(), '.happy-cloud-dev'),
31
31
  color: '\x1b[33m', // Yellow
32
32
  label: '🔧 DEV',
33
- serverUrl: process.env.HAPPY_SERVER_URL || 'https://happycloudcode.imou.com'
33
+ serverUrl: process.env.HAPPY_CLOUD_SERVER_URL || process.env.HAPPY_SERVER_URL || 'https://happycloudcode.imou.com'
34
34
  }
35
35
  };
36
36
 
@@ -42,8 +42,8 @@ if (!variant || !VARIANTS[variant]) {
42
42
  console.error('Usage: node scripts/env-wrapper.js <stable|dev> <command> [...args]');
43
43
  console.error('');
44
44
  console.error('Variants:');
45
- console.error(' stable - Production-ready version (data: ~/.happy/)');
46
- console.error(' dev - Development version (data: ~/.happy-dev/)');
45
+ console.error(' stable - Production-ready version (data: ~/.happy-cloud/)');
46
+ console.error(' dev - Development version (data: ~/.happy-cloud-dev/)');
47
47
  console.error('');
48
48
  console.error('Examples:');
49
49
  console.error(' node scripts/env-wrapper.js stable daemon start');
@@ -64,8 +64,8 @@ console.log(`${config.color}${config.label}\x1b[0m Happy Cloud CLI (data: ${conf
64
64
  // Set environment and execute command
65
65
  const env = {
66
66
  ...process.env,
67
- HAPPY_HOME_DIR: config.homeDir,
68
- HAPPY_SERVER_URL: config.serverUrl,
67
+ HAPPY_CLOUD_HOME_DIR: config.homeDir,
68
+ HAPPY_CLOUD_SERVER_URL: config.serverUrl,
69
69
  HAPPY_VARIANT: variant, // For internal validation
70
70
  };
71
71
 
@@ -10,8 +10,8 @@ const fs = require('fs');
10
10
  const path = require('path');
11
11
  const os = require('os');
12
12
 
13
- const STABLE_DIR = path.join(os.homedir(), '.happy');
14
- const DEV_DIR = path.join(os.homedir(), '.happy-dev');
13
+ const STABLE_DIR = path.join(os.homedir(), '.happy-cloud');
14
+ const DEV_DIR = path.join(os.homedir(), '.happy-cloud-dev');
15
15
 
16
16
  console.log('🔧 Setting up happy-cli development environment...\n');
17
17
 
@@ -27,10 +27,10 @@ console.log('🔧 Setting up happy-cli development environment...\n');
27
27
 
28
28
  // Create .envrc for direnv users (optional)
29
29
  const envrcContent = `# Happy Cloud CLI environment (for direnv users)
30
- # Automatically sets HAPPY_HOME_DIR based on directory
30
+ # Automatically sets HAPPY_CLOUD_HOME_DIR based on directory
31
31
  #
32
32
  # To use: cd to happy-cli-dev directory, run: direnv allow
33
- export HAPPY_HOME_DIR="$HOME/.happy-dev"
33
+ export HAPPY_CLOUD_HOME_DIR="$HOME/.happy-cloud-dev"
34
34
  export HAPPY_VARIANT="dev"
35
35
  `;
36
36