happy-coder 0.10.0-2 → 0.10.0-3
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-mcp.mjs +32 -0
- package/dist/codex/happyMcpStdioBridge.cjs +80 -0
- package/dist/codex/happyMcpStdioBridge.d.cts +2 -0
- package/dist/codex/happyMcpStdioBridge.d.mts +2 -0
- package/dist/codex/happyMcpStdioBridge.mjs +78 -0
- package/dist/index-DPVbp4Yx.mjs +6048 -0
- package/dist/index-tqOLc1Il.cjs +6056 -0
- package/dist/index.cjs +33 -6024
- package/dist/index.mjs +33 -6024
- package/dist/lib.cjs +2 -1
- package/dist/lib.d.cts +12 -2
- package/dist/lib.d.mts +12 -2
- package/dist/lib.mjs +2 -1
- package/dist/runCodex-BxLD6H6G.cjs +1155 -0
- package/dist/runCodex-C07HQlsW.mjs +1153 -0
- package/dist/{types-WP9wteZE.cjs → types-CsJGQvQ3.cjs} +142 -45
- package/dist/{types-xfXKJHdM.mjs → types-xds_c-JJ.mjs} +106 -9
- package/package.json +18 -5
- package/scripts/ripgrep_launcher.cjs +2 -26
- package/scripts/unpack-tools.cjs +163 -0
- package/tools/archives/difftastic-LICENSE +21 -0
- package/tools/archives/difftastic-arm64-darwin.tar.gz +0 -0
- package/tools/archives/difftastic-arm64-linux.tar.gz +0 -0
- package/tools/archives/difftastic-x64-darwin.tar.gz +0 -0
- package/tools/archives/difftastic-x64-linux.tar.gz +0 -0
- package/tools/archives/difftastic-x64-win32.tar.gz +0 -0
- package/tools/archives/ripgrep-arm64-darwin.tar.gz +0 -0
- package/tools/archives/ripgrep-arm64-linux.tar.gz +0 -0
- package/tools/archives/ripgrep-x64-darwin.tar.gz +0 -0
- package/tools/archives/ripgrep-x64-linux.tar.gz +0 -0
- package/tools/archives/ripgrep-x64-win32.tar.gz +0 -0
- package/tools/licenses/difftastic-LICENSE +21 -0
- package/tools/licenses/ripgrep-LICENSE +3 -0
- package/tools/unpacked/difft +0 -0
- package/ripgrep/arm64-linux/rg +0 -0
- package/ripgrep/arm64-linux/ripgrep.node +0 -0
- package/ripgrep/x64-darwin/rg +0 -0
- package/ripgrep/x64-darwin/ripgrep.node +0 -0
- package/ripgrep/x64-linux/rg +0 -0
- package/ripgrep/x64-linux/ripgrep.node +0 -0
- package/ripgrep/x64-win32/rg.exe +0 -0
- package/ripgrep/x64-win32/ripgrep.node +0 -0
- /package/{ripgrep/COPYING → tools/archives/ripgrep-LICENSE} +0 -0
- /package/{ripgrep/arm64-darwin → tools/unpacked}/rg +0 -0
- /package/{ripgrep/arm64-darwin → tools/unpacked}/ripgrep.node +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { execFileSync } from 'child_process';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { join, dirname } from 'path';
|
|
6
|
+
|
|
7
|
+
// Ensure Node flags to reduce noisy warnings on stdout (which could interfere with MCP)
|
|
8
|
+
const hasNoWarnings = process.execArgv.includes('--no-warnings');
|
|
9
|
+
const hasNoDeprecation = process.execArgv.includes('--no-deprecation');
|
|
10
|
+
|
|
11
|
+
if (!hasNoWarnings || !hasNoDeprecation) {
|
|
12
|
+
const projectRoot = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
13
|
+
const entrypoint = join(projectRoot, 'dist', 'codex', 'happyMcpStdioBridge.mjs');
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
execFileSync(process.execPath, [
|
|
17
|
+
'--no-warnings',
|
|
18
|
+
'--no-deprecation',
|
|
19
|
+
entrypoint,
|
|
20
|
+
...process.argv.slice(2)
|
|
21
|
+
], {
|
|
22
|
+
stdio: 'inherit',
|
|
23
|
+
env: process.env
|
|
24
|
+
});
|
|
25
|
+
} catch (error) {
|
|
26
|
+
process.exit(error.status || 1);
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
// Already have desired flags; import module directly
|
|
30
|
+
import('../dist/codex/happyMcpStdioBridge.mjs');
|
|
31
|
+
}
|
|
32
|
+
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var mcp_js = require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
4
|
+
var stdio_js = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
5
|
+
var index_js = require('@modelcontextprotocol/sdk/client/index.js');
|
|
6
|
+
var streamableHttp_js = require('@modelcontextprotocol/sdk/client/streamableHttp.js');
|
|
7
|
+
var z = require('zod');
|
|
8
|
+
|
|
9
|
+
function parseArgs(argv) {
|
|
10
|
+
let url = null;
|
|
11
|
+
for (let i = 0; i < argv.length; i++) {
|
|
12
|
+
const a = argv[i];
|
|
13
|
+
if (a === "--url" && i + 1 < argv.length) {
|
|
14
|
+
url = argv[i + 1];
|
|
15
|
+
i++;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return { url };
|
|
19
|
+
}
|
|
20
|
+
async function main() {
|
|
21
|
+
const { url: urlFromArgs } = parseArgs(process.argv.slice(2));
|
|
22
|
+
const baseUrl = urlFromArgs || process.env.HAPPY_HTTP_MCP_URL || "";
|
|
23
|
+
if (!baseUrl) {
|
|
24
|
+
process.stderr.write(
|
|
25
|
+
"[happy-mcp] Missing target URL. Set HAPPY_HTTP_MCP_URL or pass --url <http://127.0.0.1:PORT>\n"
|
|
26
|
+
);
|
|
27
|
+
process.exit(2);
|
|
28
|
+
}
|
|
29
|
+
let httpClient = null;
|
|
30
|
+
async function ensureHttpClient() {
|
|
31
|
+
if (httpClient) return httpClient;
|
|
32
|
+
const client = new index_js.Client(
|
|
33
|
+
{ name: "happy-stdio-bridge", version: "1.0.0" },
|
|
34
|
+
{ capabilities: { tools: {} } }
|
|
35
|
+
);
|
|
36
|
+
const transport = new streamableHttp_js.StreamableHTTPClientTransport(new URL(baseUrl));
|
|
37
|
+
await client.connect(transport);
|
|
38
|
+
httpClient = client;
|
|
39
|
+
return client;
|
|
40
|
+
}
|
|
41
|
+
const server = new mcp_js.McpServer({
|
|
42
|
+
name: "Happy MCP Bridge",
|
|
43
|
+
version: "1.0.0",
|
|
44
|
+
description: "STDIO bridge forwarding to Happy HTTP MCP"
|
|
45
|
+
});
|
|
46
|
+
server.registerTool(
|
|
47
|
+
"change_title",
|
|
48
|
+
{
|
|
49
|
+
description: "Change the title of the current chat session",
|
|
50
|
+
title: "Change Chat Title",
|
|
51
|
+
inputSchema: {
|
|
52
|
+
title: z.z.string().describe("The new title for the chat session")
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
async (args) => {
|
|
56
|
+
try {
|
|
57
|
+
const client = await ensureHttpClient();
|
|
58
|
+
const response = await client.callTool({ name: "change_title", arguments: args });
|
|
59
|
+
return response;
|
|
60
|
+
} catch (error) {
|
|
61
|
+
return {
|
|
62
|
+
content: [
|
|
63
|
+
{ type: "text", text: `Failed to change chat title: ${error instanceof Error ? error.message : String(error)}` }
|
|
64
|
+
],
|
|
65
|
+
isError: true
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
const stdio = new stdio_js.StdioServerTransport();
|
|
71
|
+
await server.connect(stdio);
|
|
72
|
+
}
|
|
73
|
+
main().catch((err) => {
|
|
74
|
+
try {
|
|
75
|
+
process.stderr.write(`[happy-mcp] Fatal: ${err instanceof Error ? err.message : String(err)}
|
|
76
|
+
`);
|
|
77
|
+
} finally {
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
3
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
4
|
+
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
|
|
7
|
+
function parseArgs(argv) {
|
|
8
|
+
let url = null;
|
|
9
|
+
for (let i = 0; i < argv.length; i++) {
|
|
10
|
+
const a = argv[i];
|
|
11
|
+
if (a === "--url" && i + 1 < argv.length) {
|
|
12
|
+
url = argv[i + 1];
|
|
13
|
+
i++;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return { url };
|
|
17
|
+
}
|
|
18
|
+
async function main() {
|
|
19
|
+
const { url: urlFromArgs } = parseArgs(process.argv.slice(2));
|
|
20
|
+
const baseUrl = urlFromArgs || process.env.HAPPY_HTTP_MCP_URL || "";
|
|
21
|
+
if (!baseUrl) {
|
|
22
|
+
process.stderr.write(
|
|
23
|
+
"[happy-mcp] Missing target URL. Set HAPPY_HTTP_MCP_URL or pass --url <http://127.0.0.1:PORT>\n"
|
|
24
|
+
);
|
|
25
|
+
process.exit(2);
|
|
26
|
+
}
|
|
27
|
+
let httpClient = null;
|
|
28
|
+
async function ensureHttpClient() {
|
|
29
|
+
if (httpClient) return httpClient;
|
|
30
|
+
const client = new Client(
|
|
31
|
+
{ name: "happy-stdio-bridge", version: "1.0.0" },
|
|
32
|
+
{ capabilities: { tools: {} } }
|
|
33
|
+
);
|
|
34
|
+
const transport = new StreamableHTTPClientTransport(new URL(baseUrl));
|
|
35
|
+
await client.connect(transport);
|
|
36
|
+
httpClient = client;
|
|
37
|
+
return client;
|
|
38
|
+
}
|
|
39
|
+
const server = new McpServer({
|
|
40
|
+
name: "Happy MCP Bridge",
|
|
41
|
+
version: "1.0.0",
|
|
42
|
+
description: "STDIO bridge forwarding to Happy HTTP MCP"
|
|
43
|
+
});
|
|
44
|
+
server.registerTool(
|
|
45
|
+
"change_title",
|
|
46
|
+
{
|
|
47
|
+
description: "Change the title of the current chat session",
|
|
48
|
+
title: "Change Chat Title",
|
|
49
|
+
inputSchema: {
|
|
50
|
+
title: z.string().describe("The new title for the chat session")
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
async (args) => {
|
|
54
|
+
try {
|
|
55
|
+
const client = await ensureHttpClient();
|
|
56
|
+
const response = await client.callTool({ name: "change_title", arguments: args });
|
|
57
|
+
return response;
|
|
58
|
+
} catch (error) {
|
|
59
|
+
return {
|
|
60
|
+
content: [
|
|
61
|
+
{ type: "text", text: `Failed to change chat title: ${error instanceof Error ? error.message : String(error)}` }
|
|
62
|
+
],
|
|
63
|
+
isError: true
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
const stdio = new StdioServerTransport();
|
|
69
|
+
await server.connect(stdio);
|
|
70
|
+
}
|
|
71
|
+
main().catch((err) => {
|
|
72
|
+
try {
|
|
73
|
+
process.stderr.write(`[happy-mcp] Fatal: ${err instanceof Error ? err.message : String(err)}
|
|
74
|
+
`);
|
|
75
|
+
} finally {
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
});
|