@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.
- package/bin/happy.mjs +10 -0
- package/dist/{api-CwOCQeLH.cjs → api-C7FyJfZ1.cjs} +87 -7
- package/dist/{api-CIZKyfSn.mjs → api-D6WL40-U.mjs} +86 -6
- package/dist/{auth-BIleVCw0.cjs → auth-C7ZScWEw.cjs} +2 -2
- package/dist/{auth-Cas9DR3b.cjs → auth-DCsIoZLT.cjs} +4 -4
- package/dist/{auth-0VnlXT9f.mjs → auth-DO9GexAR.mjs} +4 -4
- package/dist/{auth-BE8dD20T.mjs → auth-DxJ3VvrX.mjs} +2 -2
- package/dist/{browser-Dll5hxOV.mjs → browser-AoVGRX7y.mjs} +1 -1
- package/dist/{browser-Cc08m7of.cjs → browser-DzgO4oaD.cjs} +1 -1
- package/dist/{claudeLocal-WkgLbl1a.cjs → claudeLocal-C6BdzhDx.cjs} +1 -1
- package/dist/{claudeLocal-CPT3zcIU.mjs → claudeLocal-CWNGpJ0-.mjs} +1 -1
- package/dist/{config-Draa-5XC.cjs → config-CclB3QW9.cjs} +1 -1
- package/dist/{config-rTT4qTU5.mjs → config-DZk-mJ0K.mjs} +1 -1
- package/dist/{connect-BfC1tYP_.mjs → connect-BXLUKJ5P.mjs} +4 -4
- package/dist/{connect-CJZ73syK.cjs → connect-k9CqDJ-T.cjs} +4 -4
- package/dist/{controlClient-DZMIsKsT.cjs → controlClient-B23M-WPp.cjs} +10 -1
- package/dist/{controlClient-CM_QcJnB.mjs → controlClient-DB5tDU7V.mjs} +10 -2
- package/dist/deviceKeys-BTdo34Uz.mjs +175 -0
- package/dist/deviceKeys-C540DcXl.cjs +182 -0
- package/dist/{doctor-Cya9YSA0.cjs → doctor-BQGLhrcI.cjs} +2 -2
- package/dist/{doctor-DZYB6IVc.mjs → doctor-CU4JLGQ1.mjs} +2 -2
- package/dist/{downloadImage-DfSFLb-h.mjs → downloadImage-DZXI3mXL.mjs} +3 -3
- package/dist/{downloadImage-MQMrUUxS.cjs → downloadImage-cQ1Z7hkC.cjs} +5 -5
- package/dist/{enroll-C52x8oly.mjs → enroll-B55BQR56.mjs} +3 -3
- package/dist/{enroll-BxlbVftP.cjs → enroll-Bo-CNio1.cjs} +3 -3
- package/dist/{evidence-CjWBG5rX.cjs → evidence-DQp8QWcv.cjs} +1 -1
- package/dist/{evidence-Ccd9iYcj.mjs → evidence-DTYRAaOZ.mjs} +1 -1
- package/dist/{formatImageMessage-DbyG8c2j.cjs → formatImageMessage-CixDYY6G.cjs} +1 -1
- package/dist/{formatImageMessage-B4lSxlk2.mjs → formatImageMessage-DbKSSjMx.mjs} +1 -1
- package/dist/index.cjs +42 -42
- package/dist/index.mjs +42 -42
- package/dist/{install-DAeCn8ae.mjs → install-B1e6rdy7.mjs} +2 -2
- package/dist/{install-oRAjVLjP.mjs → install-CgUPGIoF.mjs} +1 -1
- package/dist/{install-C_cp8b2-.cjs → install-D7Ir7ciZ.cjs} +2 -2
- package/dist/{install-BokHRgFW.cjs → install-DSDufaPd.cjs} +1 -1
- package/dist/lib.cjs +3 -3
- package/dist/lib.d.cts +77 -0
- package/dist/lib.d.mts +77 -0
- package/dist/lib.mjs +3 -3
- package/dist/{loadableToolOutput-Cuygmd4K.mjs → loadableToolOutput-Bfei9wPq.mjs} +3 -3
- package/dist/{loadableToolOutput-DDCJjywt.cjs → loadableToolOutput-CbLGtvST.cjs} +3 -3
- package/dist/{persistence-JLUn_Nou.cjs → persistence-CBTtC_dm.cjs} +1 -1
- package/dist/{persistence-BFjvtUad.mjs → persistence-DKfF81pd.mjs} +2 -2
- package/dist/{run-DBZqN6Kn.mjs → run-BVZsMNwN.mjs} +45 -9
- package/dist/{run-BDn2aE3Q.cjs → run-CURx7LhK.cjs} +45 -9
- package/dist/{runClaude-DNHvERX0.mjs → runClaude-6Gi0sYQy.mjs} +14 -14
- package/dist/{runClaude-uaKxPZPm.cjs → runClaude-CL3Kt5ex.cjs} +15 -15
- package/dist/{runCodex-C-RTM0wA.mjs → runCodex-ClwEgJ7M.mjs} +13 -13
- package/dist/{runCodex-82UrZLme.cjs → runCodex-YKyVBkJ3.cjs} +13 -13
- package/dist/{runGemini-Bm6-4Xm2.mjs → runGemini-BPWxVr60.mjs} +15 -15
- package/dist/{runGemini-CXMr4Jwb.cjs → runGemini-Xz2W1spn.cjs} +15 -15
- package/dist/{runOneShot-ioARRHrx.mjs → runOneShot-CdCWiiLr.mjs} +2 -2
- package/dist/{runOneShot-1B6RMYT7.cjs → runOneShot-DjZyCvDI.cjs} +2 -2
- package/dist/{serve-CwibwU6N.mjs → serve-B48JttQ3.mjs} +6 -6
- package/dist/{serve-BtdAhkIE.cjs → serve-B8vaWQA0.cjs} +6 -6
- package/dist/{session-2sU4Bu1R.mjs → session-BXboDn2V.mjs} +5 -5
- package/dist/{session-D--F87zL.cjs → session-BZO25zxp.cjs} +5 -5
- package/dist/{sessionKeyCache-D2BwO91C.mjs → sessionKeyCache-B6cGadYL.mjs} +1 -1
- package/dist/{sessionKeyCache-4Tp8pJ3N.cjs → sessionKeyCache-CDmexJ9p.cjs} +1 -1
- package/dist/{sessionList-BCSw3qYt.mjs → sessionList-CgAYZpNj.mjs} +2 -2
- package/dist/{sessionList-ICJsjNtJ.cjs → sessionList-lQ-nqEhc.cjs} +2 -2
- package/dist/{sessionSummary-Bkz52BPh.cjs → sessionSummary-CcORiQSq.cjs} +3 -3
- package/dist/{sessionSummary-lHGBWQSb.mjs → sessionSummary-DCWQoaDP.mjs} +3 -3
- package/dist/{spawnHappyCLI-D_V-AAoP.cjs → spawnHappyCLI-KiazE3kL.cjs} +1 -1
- package/dist/{spawnHappyCLI-CoORX0YW.mjs → spawnHappyCLI-yBIP_Oqi.mjs} +1 -1
- package/dist/{ssh-DL_AkRAD.mjs → ssh-q5uZhqBf.mjs} +134 -103
- package/dist/{ssh-BTOlhhxi.cjs → ssh-yMllSHu5.cjs} +138 -106
- package/dist/{task-CSpaC9HX.cjs → task-_nr7J19j.cjs} +6 -6
- package/dist/{task-CQzrHRZe.mjs → task-wNX1N2i4.mjs} +6 -6
- package/dist/{uninstall-BiKyRAb1.cjs → uninstall-Buaz7d-X.cjs} +2 -2
- package/dist/{uninstall-nFMFGUVM.mjs → uninstall-Dxf6_4mQ.mjs} +2 -2
- package/dist/{update-Dw8pgsAT.cjs → update-CGlIfa8e.cjs} +3 -3
- package/dist/{update-BcqRHXf2.mjs → update-CnnoX2cV.mjs} +3 -3
- package/package.json +1 -1
- package/dist/deviceExec-CU1R9CRb.cjs +0 -84
- package/dist/deviceExec-D93AOVV4.mjs +0 -81
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { l as logger } from './persistence-
|
|
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-
|
|
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-
|
|
7
|
-
var controlClient = require('./controlClient-
|
|
8
|
-
var spawnHappyCLI = require('./spawnHappyCLI-
|
|
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-
|
|
5
|
-
import { checkIfDaemonRunningAndCleanupStaleState, stopDaemon } from './controlClient-
|
|
6
|
-
import { s as spawnHappyCLI } from './spawnHappyCLI-
|
|
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,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 };
|