@clanker-code/c2c 0.18.1 → 0.19.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.
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const path = require("node:path");
5
+ const childProcess = require("node:child_process");
6
+ const { resolveC2cBinary } = require("..");
7
+
8
+ function executableForWrapper(argv1) {
9
+ const basename = path.basename(argv1 || "c2c");
10
+ return basename.replace(/-js-wrapper\.js$/, "");
11
+ }
12
+
13
+ function packageManagerForWrapper(selfPath, env = process.env) {
14
+ const userAgent = env.npm_config_user_agent || "";
15
+ if (userAgent.startsWith("pnpm/")) {
16
+ return "pnpm";
17
+ }
18
+ if (userAgent.startsWith("bun/")) {
19
+ return "bun";
20
+ }
21
+
22
+ const normalizedPath = selfPath.replace(/\\/g, "/").toLowerCase();
23
+ if (normalizedPath.includes("/.bun/install/global/")) {
24
+ return "bun";
25
+ }
26
+ if (normalizedPath.includes("/pnpm/global/")) {
27
+ return "pnpm";
28
+ }
29
+ return "npm";
30
+ }
31
+
32
+ function main() {
33
+ const executable = executableForWrapper(process.argv[1]);
34
+ let binary;
35
+ try {
36
+ binary = resolveC2cBinary({ selfPath: __filename, executable });
37
+ } catch (error) {
38
+ console.error(error.message);
39
+ process.exit(1);
40
+ }
41
+
42
+ const result = childProcess.spawnSync(binary, process.argv.slice(2), {
43
+ stdio: "inherit",
44
+ // The native binary cannot otherwise tell that it was launched by this
45
+ // npm package wrapper. Preserve the owning package manager so
46
+ // `c2c self-update` upgrades the package instead of replacing the bundled
47
+ // binary under node_modules.
48
+ env: {
49
+ ...process.env,
50
+ // Native installers resolve the MCP server via PATH. Keep the bundled
51
+ // siblings discoverable even for an absolute wrapper invocation.
52
+ PATH: `${path.dirname(binary)}${path.delimiter}${process.env.PATH || ""}`,
53
+ C2C_SELF_UPDATE_PACKAGE_MANAGER: packageManagerForWrapper(__filename),
54
+ },
55
+ });
56
+
57
+ if (result.error) {
58
+ console.error(`failed to execute ${binary}: ${result.error.message}`);
59
+ process.exit(1);
60
+ }
61
+
62
+ if (result.signal) {
63
+ process.kill(process.pid, result.signal);
64
+ process.exit(1);
65
+ }
66
+
67
+ process.exit(result.status === null ? 1 : result.status);
68
+ }
69
+
70
+ if (require.main === module) {
71
+ main();
72
+ }
73
+
74
+ module.exports = { executableForWrapper, packageManagerForWrapper, main };
@@ -7,7 +7,7 @@ const { resolveC2cBinary } = require("..");
7
7
 
8
8
  function executableForWrapper(argv1) {
9
9
  const basename = path.basename(argv1 || "c2c");
10
- return basename.startsWith("c2c-deliver-inbox") ? "c2c-deliver-inbox" : "c2c";
10
+ return basename.replace(/-js-wrapper\.js$/, "");
11
11
  }
12
12
 
13
13
  function packageManagerForWrapper(selfPath, env = process.env) {
@@ -47,6 +47,9 @@ function main() {
47
47
  // binary under node_modules.
48
48
  env: {
49
49
  ...process.env,
50
+ // Native installers resolve the MCP server via PATH. Keep the bundled
51
+ // siblings discoverable even for an absolute wrapper invocation.
52
+ PATH: `${path.dirname(binary)}${path.delimiter}${process.env.PATH || ""}`,
50
53
  C2C_SELF_UPDATE_PACKAGE_MANAGER: packageManagerForWrapper(__filename),
51
54
  },
52
55
  });
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const path = require("node:path");
5
+ const childProcess = require("node:child_process");
6
+ const { resolveC2cBinary } = require("..");
7
+
8
+ function executableForWrapper(argv1) {
9
+ const basename = path.basename(argv1 || "c2c");
10
+ return basename.replace(/-js-wrapper\.js$/, "");
11
+ }
12
+
13
+ function packageManagerForWrapper(selfPath, env = process.env) {
14
+ const userAgent = env.npm_config_user_agent || "";
15
+ if (userAgent.startsWith("pnpm/")) {
16
+ return "pnpm";
17
+ }
18
+ if (userAgent.startsWith("bun/")) {
19
+ return "bun";
20
+ }
21
+
22
+ const normalizedPath = selfPath.replace(/\\/g, "/").toLowerCase();
23
+ if (normalizedPath.includes("/.bun/install/global/")) {
24
+ return "bun";
25
+ }
26
+ if (normalizedPath.includes("/pnpm/global/")) {
27
+ return "pnpm";
28
+ }
29
+ return "npm";
30
+ }
31
+
32
+ function main() {
33
+ const executable = executableForWrapper(process.argv[1]);
34
+ let binary;
35
+ try {
36
+ binary = resolveC2cBinary({ selfPath: __filename, executable });
37
+ } catch (error) {
38
+ console.error(error.message);
39
+ process.exit(1);
40
+ }
41
+
42
+ const result = childProcess.spawnSync(binary, process.argv.slice(2), {
43
+ stdio: "inherit",
44
+ // The native binary cannot otherwise tell that it was launched by this
45
+ // npm package wrapper. Preserve the owning package manager so
46
+ // `c2c self-update` upgrades the package instead of replacing the bundled
47
+ // binary under node_modules.
48
+ env: {
49
+ ...process.env,
50
+ // Native installers resolve the MCP server via PATH. Keep the bundled
51
+ // siblings discoverable even for an absolute wrapper invocation.
52
+ PATH: `${path.dirname(binary)}${path.delimiter}${process.env.PATH || ""}`,
53
+ C2C_SELF_UPDATE_PACKAGE_MANAGER: packageManagerForWrapper(__filename),
54
+ },
55
+ });
56
+
57
+ if (result.error) {
58
+ console.error(`failed to execute ${binary}: ${result.error.message}`);
59
+ process.exit(1);
60
+ }
61
+
62
+ if (result.signal) {
63
+ process.kill(process.pid, result.signal);
64
+ process.exit(1);
65
+ }
66
+
67
+ process.exit(result.status === null ? 1 : result.status);
68
+ }
69
+
70
+ if (require.main === module) {
71
+ main();
72
+ }
73
+
74
+ module.exports = { executableForWrapper, packageManagerForWrapper, main };
@@ -7,7 +7,7 @@ const { resolveC2cBinary } = require("..");
7
7
 
8
8
  function executableForWrapper(argv1) {
9
9
  const basename = path.basename(argv1 || "c2c");
10
- return basename.startsWith("c2c-deliver-inbox") ? "c2c-deliver-inbox" : "c2c";
10
+ return basename.replace(/-js-wrapper\.js$/, "");
11
11
  }
12
12
 
13
13
  function packageManagerForWrapper(selfPath, env = process.env) {
@@ -47,6 +47,9 @@ function main() {
47
47
  // binary under node_modules.
48
48
  env: {
49
49
  ...process.env,
50
+ // Native installers resolve the MCP server via PATH. Keep the bundled
51
+ // siblings discoverable even for an absolute wrapper invocation.
52
+ PATH: `${path.dirname(binary)}${path.delimiter}${process.env.PATH || ""}`,
50
53
  C2C_SELF_UPDATE_PACKAGE_MANAGER: packageManagerForWrapper(__filename),
51
54
  },
52
55
  });
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const path = require("node:path");
5
+ const childProcess = require("node:child_process");
6
+ const { resolveC2cBinary } = require("..");
7
+
8
+ function executableForWrapper(argv1) {
9
+ const basename = path.basename(argv1 || "c2c");
10
+ return basename.replace(/-js-wrapper\.js$/, "");
11
+ }
12
+
13
+ function packageManagerForWrapper(selfPath, env = process.env) {
14
+ const userAgent = env.npm_config_user_agent || "";
15
+ if (userAgent.startsWith("pnpm/")) {
16
+ return "pnpm";
17
+ }
18
+ if (userAgent.startsWith("bun/")) {
19
+ return "bun";
20
+ }
21
+
22
+ const normalizedPath = selfPath.replace(/\\/g, "/").toLowerCase();
23
+ if (normalizedPath.includes("/.bun/install/global/")) {
24
+ return "bun";
25
+ }
26
+ if (normalizedPath.includes("/pnpm/global/")) {
27
+ return "pnpm";
28
+ }
29
+ return "npm";
30
+ }
31
+
32
+ function main() {
33
+ const executable = executableForWrapper(process.argv[1]);
34
+ let binary;
35
+ try {
36
+ binary = resolveC2cBinary({ selfPath: __filename, executable });
37
+ } catch (error) {
38
+ console.error(error.message);
39
+ process.exit(1);
40
+ }
41
+
42
+ const result = childProcess.spawnSync(binary, process.argv.slice(2), {
43
+ stdio: "inherit",
44
+ // The native binary cannot otherwise tell that it was launched by this
45
+ // npm package wrapper. Preserve the owning package manager so
46
+ // `c2c self-update` upgrades the package instead of replacing the bundled
47
+ // binary under node_modules.
48
+ env: {
49
+ ...process.env,
50
+ // Native installers resolve the MCP server via PATH. Keep the bundled
51
+ // siblings discoverable even for an absolute wrapper invocation.
52
+ PATH: `${path.dirname(binary)}${path.delimiter}${process.env.PATH || ""}`,
53
+ C2C_SELF_UPDATE_PACKAGE_MANAGER: packageManagerForWrapper(__filename),
54
+ },
55
+ });
56
+
57
+ if (result.error) {
58
+ console.error(`failed to execute ${binary}: ${result.error.message}`);
59
+ process.exit(1);
60
+ }
61
+
62
+ if (result.signal) {
63
+ process.kill(process.pid, result.signal);
64
+ process.exit(1);
65
+ }
66
+
67
+ process.exit(result.status === null ? 1 : result.status);
68
+ }
69
+
70
+ if (require.main === module) {
71
+ main();
72
+ }
73
+
74
+ module.exports = { executableForWrapper, packageManagerForWrapper, main };
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const path = require("node:path");
5
+ const childProcess = require("node:child_process");
6
+ const { resolveC2cBinary } = require("..");
7
+
8
+ function executableForWrapper(argv1) {
9
+ const basename = path.basename(argv1 || "c2c");
10
+ return basename.replace(/-js-wrapper\.js$/, "");
11
+ }
12
+
13
+ function packageManagerForWrapper(selfPath, env = process.env) {
14
+ const userAgent = env.npm_config_user_agent || "";
15
+ if (userAgent.startsWith("pnpm/")) {
16
+ return "pnpm";
17
+ }
18
+ if (userAgent.startsWith("bun/")) {
19
+ return "bun";
20
+ }
21
+
22
+ const normalizedPath = selfPath.replace(/\\/g, "/").toLowerCase();
23
+ if (normalizedPath.includes("/.bun/install/global/")) {
24
+ return "bun";
25
+ }
26
+ if (normalizedPath.includes("/pnpm/global/")) {
27
+ return "pnpm";
28
+ }
29
+ return "npm";
30
+ }
31
+
32
+ function main() {
33
+ const executable = executableForWrapper(process.argv[1]);
34
+ let binary;
35
+ try {
36
+ binary = resolveC2cBinary({ selfPath: __filename, executable });
37
+ } catch (error) {
38
+ console.error(error.message);
39
+ process.exit(1);
40
+ }
41
+
42
+ const result = childProcess.spawnSync(binary, process.argv.slice(2), {
43
+ stdio: "inherit",
44
+ // The native binary cannot otherwise tell that it was launched by this
45
+ // npm package wrapper. Preserve the owning package manager so
46
+ // `c2c self-update` upgrades the package instead of replacing the bundled
47
+ // binary under node_modules.
48
+ env: {
49
+ ...process.env,
50
+ // Native installers resolve the MCP server via PATH. Keep the bundled
51
+ // siblings discoverable even for an absolute wrapper invocation.
52
+ PATH: `${path.dirname(binary)}${path.delimiter}${process.env.PATH || ""}`,
53
+ C2C_SELF_UPDATE_PACKAGE_MANAGER: packageManagerForWrapper(__filename),
54
+ },
55
+ });
56
+
57
+ if (result.error) {
58
+ console.error(`failed to execute ${binary}: ${result.error.message}`);
59
+ process.exit(1);
60
+ }
61
+
62
+ if (result.signal) {
63
+ process.kill(process.pid, result.signal);
64
+ process.exit(1);
65
+ }
66
+
67
+ process.exit(result.status === null ? 1 : result.status);
68
+ }
69
+
70
+ if (require.main === module) {
71
+ main();
72
+ }
73
+
74
+ module.exports = { executableForWrapper, packageManagerForWrapper, main };
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const path = require("node:path");
5
+ const childProcess = require("node:child_process");
6
+ const { resolveC2cBinary } = require("..");
7
+
8
+ function executableForWrapper(argv1) {
9
+ const basename = path.basename(argv1 || "c2c");
10
+ return basename.replace(/-js-wrapper\.js$/, "");
11
+ }
12
+
13
+ function packageManagerForWrapper(selfPath, env = process.env) {
14
+ const userAgent = env.npm_config_user_agent || "";
15
+ if (userAgent.startsWith("pnpm/")) {
16
+ return "pnpm";
17
+ }
18
+ if (userAgent.startsWith("bun/")) {
19
+ return "bun";
20
+ }
21
+
22
+ const normalizedPath = selfPath.replace(/\\/g, "/").toLowerCase();
23
+ if (normalizedPath.includes("/.bun/install/global/")) {
24
+ return "bun";
25
+ }
26
+ if (normalizedPath.includes("/pnpm/global/")) {
27
+ return "pnpm";
28
+ }
29
+ return "npm";
30
+ }
31
+
32
+ function main() {
33
+ const executable = executableForWrapper(process.argv[1]);
34
+ let binary;
35
+ try {
36
+ binary = resolveC2cBinary({ selfPath: __filename, executable });
37
+ } catch (error) {
38
+ console.error(error.message);
39
+ process.exit(1);
40
+ }
41
+
42
+ const result = childProcess.spawnSync(binary, process.argv.slice(2), {
43
+ stdio: "inherit",
44
+ // The native binary cannot otherwise tell that it was launched by this
45
+ // npm package wrapper. Preserve the owning package manager so
46
+ // `c2c self-update` upgrades the package instead of replacing the bundled
47
+ // binary under node_modules.
48
+ env: {
49
+ ...process.env,
50
+ // Native installers resolve the MCP server via PATH. Keep the bundled
51
+ // siblings discoverable even for an absolute wrapper invocation.
52
+ PATH: `${path.dirname(binary)}${path.delimiter}${process.env.PATH || ""}`,
53
+ C2C_SELF_UPDATE_PACKAGE_MANAGER: packageManagerForWrapper(__filename),
54
+ },
55
+ });
56
+
57
+ if (result.error) {
58
+ console.error(`failed to execute ${binary}: ${result.error.message}`);
59
+ process.exit(1);
60
+ }
61
+
62
+ if (result.signal) {
63
+ process.kill(process.pid, result.signal);
64
+ process.exit(1);
65
+ }
66
+
67
+ process.exit(result.status === null ? 1 : result.status);
68
+ }
69
+
70
+ if (require.main === module) {
71
+ main();
72
+ }
73
+
74
+ module.exports = { executableForWrapper, packageManagerForWrapper, main };
package/index.js CHANGED
@@ -18,7 +18,7 @@ const TARGETS = {
18
18
  },
19
19
  };
20
20
 
21
- const EXECUTABLES = new Set(["c2c", "c2c-deliver-inbox"]);
21
+ const EXECUTABLES = new Set(["c2c", "c2c-deliver-inbox", "c2c-mcp-server", "c2c-mcp-inner", "c2c-inbox-hook-ocaml", "c2c-cold-boot-hook", "c2c-post-compact-hook"]);
22
22
 
23
23
  function normalizeExecutable(executable = "c2c") {
24
24
  if (!EXECUTABLES.has(executable)) {
@@ -28,7 +28,7 @@ function normalizeExecutable(executable = "c2c") {
28
28
  }
29
29
 
30
30
  function envOverrideName(executable) {
31
- return executable === "c2c-deliver-inbox" ? "C2C_DELIVER_INBOX_BIN" : "C2C_BIN";
31
+ return executable === "c2c" ? "C2C_BIN" : `${executable.toUpperCase().replaceAll("-", "_")}_BIN`;
32
32
  }
33
33
 
34
34
  function canExecute(file) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clanker-code/c2c",
3
- "version": "0.18.1",
3
+ "version": "0.19.0",
4
4
  "description": "Resolver and CLI wrapper for the c2c agent messaging binary",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -10,16 +10,21 @@
10
10
  "main": "index.js",
11
11
  "bin": {
12
12
  "c2c": "bin/c2c-js-wrapper.js",
13
- "c2c-deliver-inbox": "bin/c2c-deliver-inbox-js-wrapper.js"
13
+ "c2c-deliver-inbox": "bin/c2c-deliver-inbox-js-wrapper.js",
14
+ "c2c-mcp-server": "bin/c2c-mcp-server-js-wrapper.js",
15
+ "c2c-mcp-inner": "bin/c2c-mcp-inner-js-wrapper.js",
16
+ "c2c-inbox-hook-ocaml": "bin/c2c-inbox-hook-ocaml-js-wrapper.js",
17
+ "c2c-cold-boot-hook": "bin/c2c-cold-boot-hook-js-wrapper.js",
18
+ "c2c-post-compact-hook": "bin/c2c-post-compact-hook-js-wrapper.js"
14
19
  },
15
20
  "files": [
16
21
  "bin/",
17
22
  "index.js"
18
23
  ],
19
24
  "optionalDependencies": {
20
- "@clanker-code/c2c-linux-x64": "0.18.1",
21
- "@clanker-code/c2c-linux-arm64": "0.18.1",
22
- "@clanker-code/c2c-darwin-x64": "0.18.1",
23
- "@clanker-code/c2c-darwin-arm64": "0.18.1"
25
+ "@clanker-code/c2c-linux-x64": "0.19.0",
26
+ "@clanker-code/c2c-linux-arm64": "0.19.0",
27
+ "@clanker-code/c2c-darwin-x64": "0.19.0",
28
+ "@clanker-code/c2c-darwin-arm64": "0.19.0"
24
29
  }
25
30
  }