happy-coder 0.1.13 → 0.1.14
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/dist/index.cjs +440 -297
- package/dist/index.mjs +442 -299
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +7 -2
- package/dist/lib.d.mts +7 -2
- package/dist/lib.mjs +1 -1
- package/dist/types-Cg4664gs.cjs +879 -0
- package/dist/types-DD9P_5rj.mjs +868 -0
- package/package.json +3 -3
- package/scripts/claudeInteractiveLaunch.cjs +72 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "happy-coder",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "Claude Code session sharing CLI",
|
|
5
5
|
"author": "Kirill Dubovitskiy",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"scripts": {
|
|
47
47
|
"test": "vitest run",
|
|
48
48
|
"test:watch": "vitest",
|
|
49
|
-
"build": "pkgroll",
|
|
50
|
-
"prepublishOnly": "
|
|
49
|
+
"build": "tsc --noEmit && pkgroll",
|
|
50
|
+
"prepublishOnly": "yarn build && yarn test",
|
|
51
51
|
"dev": "npx tsx --env-file .env.sample src/index.ts",
|
|
52
52
|
"dev:local-server": "HANDY_SERVER_URL=http://localhost:3005 npx tsx --env-file .env.sample src/index.ts"
|
|
53
53
|
},
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
const crypto = require('crypto');
|
|
2
2
|
const fs = require('fs');
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
// Helper to write JSON messages to fd 3
|
|
5
|
+
function writeMessage(message) {
|
|
6
|
+
try {
|
|
7
|
+
fs.writeSync(3, JSON.stringify(message) + '\n');
|
|
8
|
+
} catch (err) {
|
|
9
|
+
// fd 3 not available, ignore
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Intercept crypto.randomUUID
|
|
14
|
+
const originalRandomUUID = crypto.randomUUID;
|
|
4
15
|
Object.defineProperty(global, 'crypto', {
|
|
5
16
|
configurable: true,
|
|
6
17
|
enumerable: true,
|
|
7
18
|
get() {
|
|
8
19
|
return {
|
|
9
20
|
randomUUID: () => {
|
|
10
|
-
const uuid =
|
|
11
|
-
|
|
12
|
-
fs.writeSync(3, `${uuid}\n`);
|
|
13
|
-
} catch (err) {
|
|
14
|
-
// fd 3 not available, ignore
|
|
15
|
-
}
|
|
21
|
+
const uuid = originalRandomUUID();
|
|
22
|
+
writeMessage({ type: 'uuid', value: uuid });
|
|
16
23
|
return uuid;
|
|
17
24
|
}
|
|
18
25
|
};
|
|
@@ -23,14 +30,66 @@ Object.defineProperty(crypto, 'randomUUID', {
|
|
|
23
30
|
enumerable: true,
|
|
24
31
|
get() {
|
|
25
32
|
return () => {
|
|
26
|
-
const uuid =
|
|
27
|
-
|
|
28
|
-
fs.writeSync(3, `${uuid}\n`);
|
|
29
|
-
} catch (err) {
|
|
30
|
-
// fd 3 not available, ignore
|
|
31
|
-
}
|
|
33
|
+
const uuid = originalRandomUUID();
|
|
34
|
+
writeMessage({ type: 'uuid', value: uuid });
|
|
32
35
|
return uuid;
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
});
|
|
39
|
+
|
|
40
|
+
// Intercept fetch to track activity
|
|
41
|
+
const originalFetch = global.fetch;
|
|
42
|
+
let fetchCounter = 0;
|
|
43
|
+
|
|
44
|
+
global.fetch = function(...args) {
|
|
45
|
+
const id = ++fetchCounter;
|
|
46
|
+
const url = typeof args[0] === 'string' ? args[0] : args[0]?.url || '';
|
|
47
|
+
const method = args[1]?.method || 'GET';
|
|
48
|
+
|
|
49
|
+
// Parse URL for privacy
|
|
50
|
+
let hostname = '';
|
|
51
|
+
let path = '';
|
|
52
|
+
try {
|
|
53
|
+
const urlObj = new URL(url, 'http://localhost');
|
|
54
|
+
hostname = urlObj.hostname;
|
|
55
|
+
path = urlObj.pathname;
|
|
56
|
+
} catch (e) {
|
|
57
|
+
// If URL parsing fails, use defaults
|
|
58
|
+
hostname = 'unknown';
|
|
59
|
+
path = url;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Send fetch start event
|
|
63
|
+
writeMessage({
|
|
64
|
+
type: 'fetch-start',
|
|
65
|
+
id,
|
|
66
|
+
hostname,
|
|
67
|
+
path,
|
|
68
|
+
method,
|
|
69
|
+
timestamp: Date.now()
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// Execute the original fetch immediately
|
|
73
|
+
const fetchPromise = originalFetch(...args);
|
|
74
|
+
|
|
75
|
+
// Attach handlers to send fetch end event
|
|
76
|
+
const sendEnd = () => {
|
|
77
|
+
writeMessage({
|
|
78
|
+
type: 'fetch-end',
|
|
79
|
+
id,
|
|
80
|
+
timestamp: Date.now()
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// Send end event on both success and failure
|
|
85
|
+
fetchPromise.then(sendEnd, sendEnd);
|
|
86
|
+
|
|
87
|
+
// Return the original promise unchanged
|
|
88
|
+
return fetchPromise;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// Preserve fetch properties
|
|
92
|
+
Object.defineProperty(global.fetch, 'name', { value: 'fetch' });
|
|
93
|
+
Object.defineProperty(global.fetch, 'length', { value: originalFetch.length });
|
|
94
|
+
|
|
36
95
|
import('@anthropic-ai/claude-code/cli.js')
|