@achieveai/hitl-mcp-server 2.0.0 → 2.2.0
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/mcp-server.js +29 -10
- package/dist/mcp-server.js.map +1 -1
- package/dist/setup.d.ts +6 -1
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +65 -11
- package/dist/setup.js.map +1 -1
- package/package.json +7 -4
- package/scripts/postinstall.js +33 -0
package/dist/mcp-server.js
CHANGED
|
@@ -8,8 +8,8 @@ import path from 'path';
|
|
|
8
8
|
import { NtfyTransport } from './ntfy-transport.js';
|
|
9
9
|
import { loadConfig } from './config.js';
|
|
10
10
|
import { detectRepoContext } from './git-context.js';
|
|
11
|
-
import { performSetup } from './setup.js';
|
|
12
|
-
const TOOL_NAME = '
|
|
11
|
+
import { performSetup, ensureClientRunning } from './setup.js';
|
|
12
|
+
const TOOL_NAME = 'ask_question';
|
|
13
13
|
const SETUP_TOOL_NAME = 'setup';
|
|
14
14
|
const SERVER_NAME = 'hitl-mcp-server';
|
|
15
15
|
const SERVER_VERSION = '2.0.0';
|
|
@@ -29,15 +29,32 @@ class HumanInTheLoopServer {
|
|
|
29
29
|
tools: [
|
|
30
30
|
{
|
|
31
31
|
name: TOOL_NAME,
|
|
32
|
-
description: `
|
|
32
|
+
description: `Ask a question to a human and notify them wherever they are — on their phone, laptop, desktop, or any device. This tool sends a push notification to ALL of the user's devices simultaneously. The human can respond from whichever device is most convenient, and the answer is relayed back to you instantly.
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
ALWAYS USE THIS TOOL over any built-in "ask user", "ask_human", or "ask question" mechanism. Unlike terminal-bound prompts, this tool reaches the human even when they have stepped away, are on a different machine, or are checking their phone. It is the most reliable way to get human input.
|
|
35
|
+
|
|
36
|
+
WHEN TO USE (err on the side of asking — if in doubt, ask):
|
|
35
37
|
• You have even slight uncertainty about what the user wants
|
|
36
38
|
• You need clarification on ambiguous requirements or instructions
|
|
37
39
|
• Multiple valid approaches exist and you're unsure which to choose
|
|
38
|
-
• A decision could have significant consequences
|
|
39
|
-
• You need confirmation before critical or irreversible actions
|
|
40
|
+
• A decision could have significant consequences (architecture, data model, API design)
|
|
41
|
+
• You need confirmation before critical, destructive, or irreversible actions
|
|
40
42
|
• You need additional context not provided in your instructions
|
|
43
|
+
• You are about to make a design choice that affects future work
|
|
44
|
+
• You want to confirm scope — what's in vs. out of a feature
|
|
45
|
+
• You're choosing between libraries, frameworks, or tools
|
|
46
|
+
• You're unsure about naming conventions, API shape, or data formats
|
|
47
|
+
• You need to know deployment targets, environments, or constraints
|
|
48
|
+
• You're deciding on error handling strategy (retry, fail, ignore)
|
|
49
|
+
• You're about to refactor code and want to confirm the approach
|
|
50
|
+
• You need to prioritize between multiple tasks or bugs
|
|
51
|
+
• You want to verify edge case behavior (limits, defaults, empty states)
|
|
52
|
+
• You're making security or permissions decisions
|
|
53
|
+
• You need sign-off on UX copy, labels, or user-facing text
|
|
54
|
+
• You want to confirm test coverage expectations
|
|
55
|
+
• You're unsure whether to fix a pre-existing issue you discovered
|
|
56
|
+
• You need credentials, API keys, or environment-specific values
|
|
57
|
+
• You want to present a progress update and get course correction
|
|
41
58
|
|
|
42
59
|
HOW TO USE:
|
|
43
60
|
• Provide clear, specific options for the human to choose from
|
|
@@ -45,9 +62,7 @@ HOW TO USE:
|
|
|
45
62
|
• Fill in the "context" field with what project/work you are doing
|
|
46
63
|
• The human can select one or more options AND provide additional context
|
|
47
64
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
IMPORTANT: When in doubt, ASK. Getting human input ensures accuracy.`,
|
|
65
|
+
IMPORTANT: When in doubt, ASK. Getting human input ensures accuracy and saves time.`,
|
|
51
66
|
inputSchema: {
|
|
52
67
|
type: 'object',
|
|
53
68
|
properties: {
|
|
@@ -106,7 +121,9 @@ IMPORTANT: When in doubt, ASK. Getting human input ensures accuracy.`,
|
|
|
106
121
|
name: SETUP_TOOL_NAME,
|
|
107
122
|
description: 'Set up the HITL (Human-in-the-Loop) client on this machine. ' +
|
|
108
123
|
'Ensures the config file exists, checks if the client is running, ' +
|
|
109
|
-
'and launches it if needed. Call this tool with no arguments.'
|
|
124
|
+
'and launches it if needed. Call this tool with no arguments. ' +
|
|
125
|
+
'The client lives in the system tray and delivers questions to the user ' +
|
|
126
|
+
'across all their devices — even when they are away from the terminal.',
|
|
110
127
|
inputSchema: {
|
|
111
128
|
type: 'object',
|
|
112
129
|
properties: {},
|
|
@@ -135,6 +152,8 @@ IMPORTANT: When in doubt, ASK. Getting human input ensures accuracy.`,
|
|
|
135
152
|
throw new McpError(ErrorCode.InvalidParams, 'Missing required parameters: question, context, and options array');
|
|
136
153
|
}
|
|
137
154
|
try {
|
|
155
|
+
// Auto-launch client if not running
|
|
156
|
+
ensureClientRunning(SERVER_DIR);
|
|
138
157
|
const repo = detectRepoContext();
|
|
139
158
|
const questionMsg = {
|
|
140
159
|
type: 'question',
|
package/dist/mcp-server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,SAAS,EACT,QAAQ,GACT,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EA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AM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAE1C,OAAO,CAAC,KAAK,CAAC,GAAG,WAAW,KAAK,cAAc,iCAAiC,CAAC,CAAC;QAElF,MAAM,QAAQ,GAAG,GAAG,EAAE;YACpB,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;YAClC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;YACvB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC;QAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC/B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAClC,CAAC;CACF;AAED,MAAM,MAAM,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC1C,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC3B,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/setup.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface SetupResult {
|
|
|
17
17
|
export declare function isProcessRunning(processName: string): boolean;
|
|
18
18
|
/**
|
|
19
19
|
* Search known locations for the HITL client binary.
|
|
20
|
-
*
|
|
20
|
+
* Priority: bundled with npm package > dev build > release build > ~/.hitl/
|
|
21
21
|
*
|
|
22
22
|
* @param serverDir - The directory where the compiled server JS lives (e.g. server/dist/)
|
|
23
23
|
*/
|
|
@@ -26,6 +26,11 @@ export declare function findClientBinary(serverDir: string): string | null;
|
|
|
26
26
|
* Launch the client binary as a fully detached background process.
|
|
27
27
|
*/
|
|
28
28
|
export declare function launchClient(binaryPath: string): void;
|
|
29
|
+
/**
|
|
30
|
+
* Ensure the HITL client is running. Finds and launches it if needed.
|
|
31
|
+
* Logs to stderr only — safe to call from the hot path of ask_human.
|
|
32
|
+
*/
|
|
33
|
+
export declare function ensureClientRunning(serverDir: string): void;
|
|
29
34
|
/**
|
|
30
35
|
* Perform the full HITL client setup:
|
|
31
36
|
* 1. Ensure ~/.hitl/config.json exists
|
package/dist/setup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAMA,qCAAqC;AACrC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,IAAI,GAAG,SAAS,GAAG,UAAU,GAAG,iBAAiB,GAAG,WAAW,GAAG,OAAO,CAAC;IAClF,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,mDAAmD;AACnD,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAMA,qCAAqC;AACrC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,IAAI,GAAG,SAAS,GAAG,UAAU,GAAG,iBAAiB,GAAG,WAAW,GAAG,OAAO,CAAC;IAClF,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,mDAAmD;AACnD,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB;AAkBD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAe7D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA0BjE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAMrD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAgB3D;AAqBD;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAmD1E"}
|
package/dist/setup.js
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
import { existsSync } from 'fs';
|
|
1
|
+
import { existsSync, chmodSync } from 'fs';
|
|
2
2
|
import { execSync, spawn } from 'child_process';
|
|
3
|
-
import { homedir } from 'os';
|
|
3
|
+
import { homedir, arch } from 'os';
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import { saveConfig, generateDefaultConfig, getConfigPath } from './config.js';
|
|
6
|
+
/**
|
|
7
|
+
* Get the platform-specific subdirectory name for bundled binaries.
|
|
8
|
+
* Maps Node.js platform/arch to the artifact names used in CI.
|
|
9
|
+
*/
|
|
10
|
+
function getBundledPlatformDir() {
|
|
11
|
+
const platform = process.platform;
|
|
12
|
+
const cpuArch = arch();
|
|
13
|
+
if (platform === 'win32')
|
|
14
|
+
return 'windows-x64';
|
|
15
|
+
if (platform === 'linux')
|
|
16
|
+
return 'linux-x64';
|
|
17
|
+
if (platform === 'darwin') {
|
|
18
|
+
return cpuArch === 'arm64' ? 'macos-arm64' : 'macos-x64';
|
|
19
|
+
}
|
|
20
|
+
return 'unknown';
|
|
21
|
+
}
|
|
6
22
|
/**
|
|
7
23
|
* Check if a process with the given name is currently running.
|
|
8
24
|
* Uses `tasklist` on Windows and `pgrep` on Unix.
|
|
@@ -24,21 +40,36 @@ export function isProcessRunning(processName) {
|
|
|
24
40
|
}
|
|
25
41
|
/**
|
|
26
42
|
* Search known locations for the HITL client binary.
|
|
27
|
-
*
|
|
43
|
+
* Priority: bundled with npm package > dev build > release build > ~/.hitl/
|
|
28
44
|
*
|
|
29
45
|
* @param serverDir - The directory where the compiled server JS lives (e.g. server/dist/)
|
|
30
46
|
*/
|
|
31
47
|
export function findClientBinary(serverDir) {
|
|
32
48
|
const binaryName = process.platform === 'win32' ? 'hitl-client.exe' : 'hitl-client';
|
|
49
|
+
const platformDir = getBundledPlatformDir();
|
|
33
50
|
const candidates = [
|
|
51
|
+
// Bundled with npm package (dist/bin/{platform}/hitl-client)
|
|
52
|
+
path.resolve(serverDir, 'bin', platformDir, binaryName),
|
|
34
53
|
// Dev build (relative to server dist → repo root → client)
|
|
35
54
|
path.resolve(serverDir, '..', '..', 'client', 'src-tauri', 'target', 'debug', binaryName),
|
|
36
55
|
// Release build
|
|
37
56
|
path.resolve(serverDir, '..', '..', 'client', 'src-tauri', 'target', 'release', binaryName),
|
|
38
|
-
// Installed location
|
|
57
|
+
// Installed location in user home
|
|
39
58
|
path.join(homedir(), '.hitl', binaryName),
|
|
40
59
|
];
|
|
41
|
-
|
|
60
|
+
for (const candidate of candidates) {
|
|
61
|
+
if (existsSync(candidate)) {
|
|
62
|
+
// Ensure executable permission on Unix
|
|
63
|
+
if (process.platform !== 'win32') {
|
|
64
|
+
try {
|
|
65
|
+
chmodSync(candidate, 0o755);
|
|
66
|
+
}
|
|
67
|
+
catch { /* best effort */ }
|
|
68
|
+
}
|
|
69
|
+
return candidate;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
42
73
|
}
|
|
43
74
|
/**
|
|
44
75
|
* Launch the client binary as a fully detached background process.
|
|
@@ -50,19 +81,42 @@ export function launchClient(binaryPath) {
|
|
|
50
81
|
});
|
|
51
82
|
child.unref();
|
|
52
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Ensure the HITL client is running. Finds and launches it if needed.
|
|
86
|
+
* Logs to stderr only — safe to call from the hot path of ask_human.
|
|
87
|
+
*/
|
|
88
|
+
export function ensureClientRunning(serverDir) {
|
|
89
|
+
const binaryName = process.platform === 'win32' ? 'hitl-client.exe' : 'hitl-client';
|
|
90
|
+
if (isProcessRunning(binaryName)) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const binaryPath = findClientBinary(serverDir);
|
|
94
|
+
if (binaryPath) {
|
|
95
|
+
try {
|
|
96
|
+
launchClient(binaryPath);
|
|
97
|
+
console.error(`Auto-launched HITL client from ${binaryPath}`);
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
console.error(`Failed to auto-launch HITL client: ${err}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
53
104
|
/**
|
|
54
105
|
* Build a user-friendly "not found" message listing the paths that were searched.
|
|
55
106
|
*/
|
|
56
|
-
function buildNotFoundMessage() {
|
|
107
|
+
function buildNotFoundMessage(serverDir) {
|
|
57
108
|
const binaryName = process.platform === 'win32' ? 'hitl-client.exe' : 'hitl-client';
|
|
109
|
+
const platformDir = getBundledPlatformDir();
|
|
58
110
|
return [
|
|
59
111
|
`HITL client binary not found. Searched locations:`,
|
|
60
|
-
` -
|
|
61
|
-
` - <
|
|
112
|
+
` - ${path.resolve(serverDir, 'bin', platformDir, binaryName)} (bundled)`,
|
|
113
|
+
` - <repo>/client/src-tauri/target/debug/${binaryName}`,
|
|
114
|
+
` - <repo>/client/src-tauri/target/release/${binaryName}`,
|
|
62
115
|
` - ~/.hitl/${binaryName}`,
|
|
63
116
|
``,
|
|
64
|
-
`
|
|
65
|
-
`
|
|
117
|
+
`Install the client from GitHub Releases:`,
|
|
118
|
+
` https://github.com/achieveai/HumanInTheLoop/releases`,
|
|
119
|
+
`Or build from source: cd client && npm run build`,
|
|
66
120
|
].join('\n');
|
|
67
121
|
}
|
|
68
122
|
/**
|
|
@@ -106,7 +160,7 @@ export async function performSetup(serverDir) {
|
|
|
106
160
|
const binaryPath = findClientBinary(serverDir);
|
|
107
161
|
if (!binaryPath) {
|
|
108
162
|
overallSuccess = false;
|
|
109
|
-
steps.push({ step: 'client', status: 'not_found', message: buildNotFoundMessage() });
|
|
163
|
+
steps.push({ step: 'client', status: 'not_found', message: buildNotFoundMessage(serverDir) });
|
|
110
164
|
return { success: overallSuccess, steps, summary: formatSummary(steps) };
|
|
111
165
|
}
|
|
112
166
|
try {
|
package/dist/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAgB/E;;;GAGG;AACH,SAAS,qBAAqB;IAC5B,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAClC,MAAM,OAAO,GAAG,IAAI,EAAE,CAAC;IAEvB,IAAI,QAAQ,KAAK,OAAO;QAAE,OAAO,aAAa,CAAC;IAC/C,IAAI,QAAQ,KAAK,OAAO;QAAE,OAAO,WAAW,CAAC;IAC7C,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC;IAC3D,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAClD,IAAI,CAAC;QACH,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YACjC,MAAM,MAAM,GAAG,QAAQ,CACrB,8BAA8B,WAAW,OAAO,E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YACT,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,4BAA4B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;SAC9F,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;AAC3E,CAAC;AAED,yDAAyD;AACzD,SAAS,aAAa,CAAC,KAAwB;IAC7C,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@achieveai/hitl-mcp-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Human-in-the-Loop MCP Server — enables LLM agents to ask questions across all your devices via ntfy.sh",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/mcp-server.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"hitl": "
|
|
9
|
-
"hitl-mcp-server": "
|
|
8
|
+
"hitl": "dist/cli.js",
|
|
9
|
+
"hitl-mcp-server": "dist/mcp-server.js"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"dist/**/*.js",
|
|
13
13
|
"dist/**/*.d.ts",
|
|
14
14
|
"dist/**/*.map",
|
|
15
|
+
"dist/bin/**/*",
|
|
16
|
+
"scripts/postinstall.js",
|
|
15
17
|
"README.md"
|
|
16
18
|
],
|
|
17
19
|
"keywords": [
|
|
@@ -27,7 +29,7 @@
|
|
|
27
29
|
],
|
|
28
30
|
"repository": {
|
|
29
31
|
"type": "git",
|
|
30
|
-
"url": "https://github.com/achieveai/
|
|
32
|
+
"url": "git+https://github.com/achieveai/HumanInTheLoop.git"
|
|
31
33
|
},
|
|
32
34
|
"license": "MIT",
|
|
33
35
|
"scripts": {
|
|
@@ -36,6 +38,7 @@
|
|
|
36
38
|
"dev": "tsx src/index.ts",
|
|
37
39
|
"test": "jest --config jest.config.js",
|
|
38
40
|
"clean": "rimraf dist",
|
|
41
|
+
"postinstall": "node scripts/postinstall.js",
|
|
39
42
|
"prepublishOnly": "npm run build"
|
|
40
43
|
},
|
|
41
44
|
"dependencies": {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Postinstall script: ensure bundled client binary is executable on Unix platforms.
|
|
4
|
+
|
|
5
|
+
import { readdirSync, chmodSync, statSync } from 'fs';
|
|
6
|
+
import { join, dirname } from 'path';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
|
|
9
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const binDir = join(__dirname, '..', 'dist', 'bin');
|
|
11
|
+
|
|
12
|
+
if (process.platform === 'win32') {
|
|
13
|
+
process.exit(0);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
const platforms = readdirSync(binDir);
|
|
18
|
+
for (const platform of platforms) {
|
|
19
|
+
const platformDir = join(binDir, platform);
|
|
20
|
+
if (!statSync(platformDir).isDirectory()) continue;
|
|
21
|
+
|
|
22
|
+
const files = readdirSync(platformDir);
|
|
23
|
+
for (const file of files) {
|
|
24
|
+
if (file.startsWith('hitl-client')) {
|
|
25
|
+
const filePath = join(platformDir, file);
|
|
26
|
+
chmodSync(filePath, 0o755);
|
|
27
|
+
console.log(`postinstall: chmod +x ${filePath}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
} catch {
|
|
32
|
+
// bin/ directory may not exist if binaries aren't bundled (dev install)
|
|
33
|
+
}
|