@zonease/happy 0.6.39 → 0.6.40

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 (76) hide show
  1. package/bin/happy.mjs +10 -0
  2. package/dist/{api-CwOCQeLH.cjs → api-C7FyJfZ1.cjs} +87 -7
  3. package/dist/{api-CIZKyfSn.mjs → api-D6WL40-U.mjs} +86 -6
  4. package/dist/{auth-BIleVCw0.cjs → auth-C7ZScWEw.cjs} +2 -2
  5. package/dist/{auth-Cas9DR3b.cjs → auth-DCsIoZLT.cjs} +4 -4
  6. package/dist/{auth-0VnlXT9f.mjs → auth-DO9GexAR.mjs} +4 -4
  7. package/dist/{auth-BE8dD20T.mjs → auth-DxJ3VvrX.mjs} +2 -2
  8. package/dist/{browser-Dll5hxOV.mjs → browser-AoVGRX7y.mjs} +1 -1
  9. package/dist/{browser-Cc08m7of.cjs → browser-DzgO4oaD.cjs} +1 -1
  10. package/dist/{claudeLocal-WkgLbl1a.cjs → claudeLocal-C6BdzhDx.cjs} +1 -1
  11. package/dist/{claudeLocal-CPT3zcIU.mjs → claudeLocal-CWNGpJ0-.mjs} +1 -1
  12. package/dist/{config-Draa-5XC.cjs → config-CclB3QW9.cjs} +1 -1
  13. package/dist/{config-rTT4qTU5.mjs → config-DZk-mJ0K.mjs} +1 -1
  14. package/dist/{connect-BfC1tYP_.mjs → connect-BXLUKJ5P.mjs} +4 -4
  15. package/dist/{connect-CJZ73syK.cjs → connect-k9CqDJ-T.cjs} +4 -4
  16. package/dist/{controlClient-DZMIsKsT.cjs → controlClient-B23M-WPp.cjs} +10 -1
  17. package/dist/{controlClient-CM_QcJnB.mjs → controlClient-DB5tDU7V.mjs} +10 -2
  18. package/dist/deviceKeys-BTdo34Uz.mjs +175 -0
  19. package/dist/deviceKeys-C540DcXl.cjs +182 -0
  20. package/dist/{doctor-Cya9YSA0.cjs → doctor-BQGLhrcI.cjs} +2 -2
  21. package/dist/{doctor-DZYB6IVc.mjs → doctor-CU4JLGQ1.mjs} +2 -2
  22. package/dist/{downloadImage-DfSFLb-h.mjs → downloadImage-DZXI3mXL.mjs} +3 -3
  23. package/dist/{downloadImage-MQMrUUxS.cjs → downloadImage-cQ1Z7hkC.cjs} +5 -5
  24. package/dist/{enroll-C52x8oly.mjs → enroll-B55BQR56.mjs} +3 -3
  25. package/dist/{enroll-BxlbVftP.cjs → enroll-Bo-CNio1.cjs} +3 -3
  26. package/dist/{evidence-CjWBG5rX.cjs → evidence-DQp8QWcv.cjs} +1 -1
  27. package/dist/{evidence-Ccd9iYcj.mjs → evidence-DTYRAaOZ.mjs} +1 -1
  28. package/dist/{formatImageMessage-DbyG8c2j.cjs → formatImageMessage-CixDYY6G.cjs} +1 -1
  29. package/dist/{formatImageMessage-B4lSxlk2.mjs → formatImageMessage-DbKSSjMx.mjs} +1 -1
  30. package/dist/index.cjs +42 -42
  31. package/dist/index.mjs +42 -42
  32. package/dist/{install-DAeCn8ae.mjs → install-B1e6rdy7.mjs} +2 -2
  33. package/dist/{install-oRAjVLjP.mjs → install-CgUPGIoF.mjs} +1 -1
  34. package/dist/{install-C_cp8b2-.cjs → install-D7Ir7ciZ.cjs} +2 -2
  35. package/dist/{install-BokHRgFW.cjs → install-DSDufaPd.cjs} +1 -1
  36. package/dist/lib.cjs +3 -3
  37. package/dist/lib.d.cts +77 -0
  38. package/dist/lib.d.mts +77 -0
  39. package/dist/lib.mjs +3 -3
  40. package/dist/{loadableToolOutput-Cuygmd4K.mjs → loadableToolOutput-Bfei9wPq.mjs} +3 -3
  41. package/dist/{loadableToolOutput-DDCJjywt.cjs → loadableToolOutput-CbLGtvST.cjs} +3 -3
  42. package/dist/{persistence-JLUn_Nou.cjs → persistence-CBTtC_dm.cjs} +1 -1
  43. package/dist/{persistence-BFjvtUad.mjs → persistence-DKfF81pd.mjs} +2 -2
  44. package/dist/{run-DBZqN6Kn.mjs → run-BVZsMNwN.mjs} +45 -9
  45. package/dist/{run-BDn2aE3Q.cjs → run-CURx7LhK.cjs} +45 -9
  46. package/dist/{runClaude-DNHvERX0.mjs → runClaude-6Gi0sYQy.mjs} +14 -14
  47. package/dist/{runClaude-uaKxPZPm.cjs → runClaude-CL3Kt5ex.cjs} +15 -15
  48. package/dist/{runCodex-C-RTM0wA.mjs → runCodex-ClwEgJ7M.mjs} +13 -13
  49. package/dist/{runCodex-82UrZLme.cjs → runCodex-YKyVBkJ3.cjs} +13 -13
  50. package/dist/{runGemini-Bm6-4Xm2.mjs → runGemini-BPWxVr60.mjs} +15 -15
  51. package/dist/{runGemini-CXMr4Jwb.cjs → runGemini-Xz2W1spn.cjs} +15 -15
  52. package/dist/{runOneShot-ioARRHrx.mjs → runOneShot-CdCWiiLr.mjs} +2 -2
  53. package/dist/{runOneShot-1B6RMYT7.cjs → runOneShot-DjZyCvDI.cjs} +2 -2
  54. package/dist/{serve-CwibwU6N.mjs → serve-B48JttQ3.mjs} +6 -6
  55. package/dist/{serve-BtdAhkIE.cjs → serve-B8vaWQA0.cjs} +6 -6
  56. package/dist/{session-2sU4Bu1R.mjs → session-BXboDn2V.mjs} +5 -5
  57. package/dist/{session-D--F87zL.cjs → session-BZO25zxp.cjs} +5 -5
  58. package/dist/{sessionKeyCache-D2BwO91C.mjs → sessionKeyCache-B6cGadYL.mjs} +1 -1
  59. package/dist/{sessionKeyCache-4Tp8pJ3N.cjs → sessionKeyCache-CDmexJ9p.cjs} +1 -1
  60. package/dist/{sessionList-BCSw3qYt.mjs → sessionList-CgAYZpNj.mjs} +2 -2
  61. package/dist/{sessionList-ICJsjNtJ.cjs → sessionList-lQ-nqEhc.cjs} +2 -2
  62. package/dist/{sessionSummary-Bkz52BPh.cjs → sessionSummary-CcORiQSq.cjs} +3 -3
  63. package/dist/{sessionSummary-lHGBWQSb.mjs → sessionSummary-DCWQoaDP.mjs} +3 -3
  64. package/dist/{spawnHappyCLI-D_V-AAoP.cjs → spawnHappyCLI-KiazE3kL.cjs} +1 -1
  65. package/dist/{spawnHappyCLI-CoORX0YW.mjs → spawnHappyCLI-yBIP_Oqi.mjs} +1 -1
  66. package/dist/{ssh-DL_AkRAD.mjs → ssh-q5uZhqBf.mjs} +134 -103
  67. package/dist/{ssh-BTOlhhxi.cjs → ssh-yMllSHu5.cjs} +138 -106
  68. package/dist/{task-CSpaC9HX.cjs → task-_nr7J19j.cjs} +6 -6
  69. package/dist/{task-CQzrHRZe.mjs → task-wNX1N2i4.mjs} +6 -6
  70. package/dist/{uninstall-BiKyRAb1.cjs → uninstall-Buaz7d-X.cjs} +2 -2
  71. package/dist/{uninstall-nFMFGUVM.mjs → uninstall-Dxf6_4mQ.mjs} +2 -2
  72. package/dist/{update-Dw8pgsAT.cjs → update-CGlIfa8e.cjs} +3 -3
  73. package/dist/{update-BcqRHXf2.mjs → update-CnnoX2cV.mjs} +3 -3
  74. package/package.json +1 -1
  75. package/dist/deviceExec-CU1R9CRb.cjs +0 -84
  76. package/dist/deviceExec-D93AOVV4.mjs +0 -81
@@ -1,10 +1,10 @@
1
- import { l as logger } from './persistence-BFjvtUad.mjs';
1
+ import { l as logger } from './persistence-DKfF81pd.mjs';
2
2
  import { existsSync, unlinkSync } from 'fs';
3
3
  import { execSync } from 'child_process';
4
4
  import { join } from 'path';
5
5
  import os from 'os';
6
6
  import { s as systemdScopeFor, i as isRootUser, S as SERVICE_NAME } from './systemdScope-BeOtAkhk.mjs';
7
- import { stopDaemon } from './controlClient-CM_QcJnB.mjs';
7
+ import { stopDaemon } from './controlClient-DB5tDU7V.mjs';
8
8
  import 'node:fs/promises';
9
9
  import 'node:fs';
10
10
  import 'node:os';
@@ -3,9 +3,9 @@
3
3
  var chalk = require('chalk');
4
4
  var node_child_process = require('node:child_process');
5
5
  var fs = require('node:fs');
6
- var logger = require('./persistence-JLUn_Nou.cjs');
7
- var controlClient = require('./controlClient-DZMIsKsT.cjs');
8
- var spawnHappyCLI = require('./spawnHappyCLI-D_V-AAoP.cjs');
6
+ var logger = require('./persistence-CBTtC_dm.cjs');
7
+ var controlClient = require('./controlClient-B23M-WPp.cjs');
8
+ var spawnHappyCLI = require('./spawnHappyCLI-KiazE3kL.cjs');
9
9
  require('node:fs/promises');
10
10
  require('node:os');
11
11
  require('node:path');
@@ -1,9 +1,9 @@
1
1
  import chalk from 'chalk';
2
2
  import { execFileSync, execSync } from 'node:child_process';
3
3
  import { realpathSync } from 'node:fs';
4
- import { p as packageJson } from './persistence-BFjvtUad.mjs';
5
- import { checkIfDaemonRunningAndCleanupStaleState, stopDaemon } from './controlClient-CM_QcJnB.mjs';
6
- import { s as spawnHappyCLI } from './spawnHappyCLI-CoORX0YW.mjs';
4
+ import { p as packageJson } from './persistence-DKfF81pd.mjs';
5
+ import { checkIfDaemonRunningAndCleanupStaleState, stopDaemon } from './controlClient-DB5tDU7V.mjs';
6
+ import { s as spawnHappyCLI } from './spawnHappyCLI-yBIP_Oqi.mjs';
7
7
  import 'node:fs/promises';
8
8
  import 'node:os';
9
9
  import 'node:path';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zonease/happy",
3
- "version": "0.6.39",
3
+ "version": "0.6.40",
4
4
  "description": "Mobile and Web client for Claude Code, Codex, and Gemini",
5
5
  "author": "ZonEaseTech",
6
6
  "license": "MIT",
@@ -1,84 +0,0 @@
1
- 'use strict';
2
-
3
- var axios = require('axios');
4
- var logger = require('./persistence-JLUn_Nou.cjs');
5
- var auth = require('./auth-BIleVCw0.cjs');
6
-
7
- function resolveMachineKey(credentials, dataEncryptionKey) {
8
- if (credentials.encryption.type === "legacy") {
9
- return { key: credentials.encryption.secret, variant: "legacy" };
10
- }
11
- if (!dataEncryptionKey) return null;
12
- const blob = logger.decodeBase64(dataEncryptionKey);
13
- if (blob.length < 1 || blob[0] !== 0) return null;
14
- const opened = auth.decryptWithEphemeralKey(blob.slice(1), credentials.encryption.machineKey);
15
- return opened ? { key: opened, variant: "dataKey" } : null;
16
- }
17
- async function fetchMachines(credentials) {
18
- const response = await axios.get(
19
- `${logger.configuration.serverUrl}/v1/machines`,
20
- { headers: { Authorization: `Bearer ${credentials.token}` }, timeout: 15e3 }
21
- );
22
- const data = response.data;
23
- return Array.isArray(data) ? data : data.machines ?? [];
24
- }
25
- async function listDevices(credentials) {
26
- const rows = await fetchMachines(credentials);
27
- return rows.map((row) => {
28
- const resolved = resolveMachineKey(credentials, row.dataEncryptionKey);
29
- let metadata = null;
30
- if (resolved && row.metadata) {
31
- try {
32
- metadata = logger.decrypt(resolved.key, resolved.variant, logger.decodeBase64(row.metadata));
33
- } catch {
34
- metadata = null;
35
- }
36
- }
37
- return {
38
- id: row.id,
39
- name: row.displayName || metadata?.displayName || metadata?.host || row.id.slice(0, 12),
40
- description: row.description ?? null,
41
- platform: metadata?.platform ?? null,
42
- active: row.active,
43
- lastActiveAt: row.activeAt ?? row.lastActiveAt ?? 0
44
- };
45
- });
46
- }
47
- async function deviceExec(socket, credentials, deviceId, command, options = {}) {
48
- const row = options.skipMachineLookup ? null : await (async () => {
49
- const rows = await fetchMachines(credentials);
50
- const found = rows.find((candidate) => candidate.id === deviceId);
51
- if (!found) {
52
- throw new Error(`Device ${deviceId} not found`);
53
- }
54
- if (!found.active) {
55
- throw new Error(`Device ${deviceId} is offline`);
56
- }
57
- return found;
58
- })();
59
- const resolved = options.deviceKeyBase64 ? { key: logger.decodeBase64(options.deviceKeyBase64), variant: options.deviceKeyVariant ?? "dataKey" } : resolveMachineKey(credentials, row.dataEncryptionKey);
60
- if (!resolved) {
61
- throw new Error(`Cannot resolve encryption key for device ${deviceId}. Re-select the device in the app.`);
62
- }
63
- const timeout = options.timeout ?? 6e4;
64
- const params = logger.encodeBase64(logger.encrypt(resolved.key, resolved.variant, {
65
- command,
66
- cwd: options.cwd,
67
- timeout
68
- }));
69
- const answer = await socket.timeout(timeout + 5e3).emitWithAck("rpc-call", {
70
- method: `${deviceId}:bash`,
71
- params
72
- });
73
- if (!answer?.ok) {
74
- throw new Error(answer?.error || "Device RPC failed");
75
- }
76
- const decrypted = logger.decrypt(resolved.key, resolved.variant, logger.decodeBase64(answer.result));
77
- if (!decrypted) {
78
- throw new Error("Failed to decrypt device response");
79
- }
80
- return decrypted;
81
- }
82
-
83
- exports.deviceExec = deviceExec;
84
- exports.listDevices = listDevices;
@@ -1,81 +0,0 @@
1
- import axios from 'axios';
2
- import { e as decodeBase64, f as encodeBase64, g as encrypt, h as decrypt, c as configuration } from './persistence-BFjvtUad.mjs';
3
- import { decryptWithEphemeralKey } from './auth-BE8dD20T.mjs';
4
-
5
- function resolveMachineKey(credentials, dataEncryptionKey) {
6
- if (credentials.encryption.type === "legacy") {
7
- return { key: credentials.encryption.secret, variant: "legacy" };
8
- }
9
- if (!dataEncryptionKey) return null;
10
- const blob = decodeBase64(dataEncryptionKey);
11
- if (blob.length < 1 || blob[0] !== 0) return null;
12
- const opened = decryptWithEphemeralKey(blob.slice(1), credentials.encryption.machineKey);
13
- return opened ? { key: opened, variant: "dataKey" } : null;
14
- }
15
- async function fetchMachines(credentials) {
16
- const response = await axios.get(
17
- `${configuration.serverUrl}/v1/machines`,
18
- { headers: { Authorization: `Bearer ${credentials.token}` }, timeout: 15e3 }
19
- );
20
- const data = response.data;
21
- return Array.isArray(data) ? data : data.machines ?? [];
22
- }
23
- async function listDevices(credentials) {
24
- const rows = await fetchMachines(credentials);
25
- return rows.map((row) => {
26
- const resolved = resolveMachineKey(credentials, row.dataEncryptionKey);
27
- let metadata = null;
28
- if (resolved && row.metadata) {
29
- try {
30
- metadata = decrypt(resolved.key, resolved.variant, decodeBase64(row.metadata));
31
- } catch {
32
- metadata = null;
33
- }
34
- }
35
- return {
36
- id: row.id,
37
- name: row.displayName || metadata?.displayName || metadata?.host || row.id.slice(0, 12),
38
- description: row.description ?? null,
39
- platform: metadata?.platform ?? null,
40
- active: row.active,
41
- lastActiveAt: row.activeAt ?? row.lastActiveAt ?? 0
42
- };
43
- });
44
- }
45
- async function deviceExec(socket, credentials, deviceId, command, options = {}) {
46
- const row = options.skipMachineLookup ? null : await (async () => {
47
- const rows = await fetchMachines(credentials);
48
- const found = rows.find((candidate) => candidate.id === deviceId);
49
- if (!found) {
50
- throw new Error(`Device ${deviceId} not found`);
51
- }
52
- if (!found.active) {
53
- throw new Error(`Device ${deviceId} is offline`);
54
- }
55
- return found;
56
- })();
57
- const resolved = options.deviceKeyBase64 ? { key: decodeBase64(options.deviceKeyBase64), variant: options.deviceKeyVariant ?? "dataKey" } : resolveMachineKey(credentials, row.dataEncryptionKey);
58
- if (!resolved) {
59
- throw new Error(`Cannot resolve encryption key for device ${deviceId}. Re-select the device in the app.`);
60
- }
61
- const timeout = options.timeout ?? 6e4;
62
- const params = encodeBase64(encrypt(resolved.key, resolved.variant, {
63
- command,
64
- cwd: options.cwd,
65
- timeout
66
- }));
67
- const answer = await socket.timeout(timeout + 5e3).emitWithAck("rpc-call", {
68
- method: `${deviceId}:bash`,
69
- params
70
- });
71
- if (!answer?.ok) {
72
- throw new Error(answer?.error || "Device RPC failed");
73
- }
74
- const decrypted = decrypt(resolved.key, resolved.variant, decodeBase64(answer.result));
75
- if (!decrypted) {
76
- throw new Error("Failed to decrypt device response");
77
- }
78
- return decrypted;
79
- }
80
-
81
- export { deviceExec as d, listDevices as l };